- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
02-Web cache policy commands | 71.71 KB |
Web cache policy commands
aging-time
Use aging-time to set the aging time of cached files.
Use undo aging-time to restore the default.
Syntax
aging-time time-value
undo aging-time
Default
The aging time of cached files is 60 minutes.
Views
Web cache policy view
Predefined user roles
network-admin
context-admin
Parameters
time-value: Specifies the aging time in the range of 1 to 1440 minutes.
Usage guidelines
A cached file is automatically deleted when its aging timer expires.
The aging timer of a cached file is not restarted when the device receives the same HTTP requests as the first HTTP request that triggers the generation of the file.
If you modify the aging time, the new setting takes effect only on newly generated files and does not affect existing files.
Examples
# Set the aging time of cached files to 180 minutes in HTTP Web cache policy cp1.
<Sysname> system-view
[Sysname] cache-policy cp1 type http
[Sysname-cp-http-cp1] default-aging-time 180
cache-policy
Use cache-policy to create a Web cache policy and enter its view, or enter the view of an existing Web cache policy.
Use undo cache-policy to delete a Web cache policy.
Syntax
cache-policy cache-policy-name [ type http ]
undo cache-policy cache-policy-name
Default
No Web cache policies exist.
Views
System view
Predefined user roles
network-admin
context-admin
Parameters
cache-policy-name: Specifies a Web cache policy name, a case-insensitive string of 1 to 63 characters.
type http: Specifies the HTTP type for the cache policy. The type http keywords are optional when you create a Web cache policy. If you specify them, you must also specify them when entering the view of an existing Web cache policy.
Examples
# Create an HTTP Web cache policy named cp1 and enter its view.
<Sysname> system-view
[Sysname] cache-policy cp1 type http
[Sysname-cp-http-cp1]
display cache-policy
Use display cache-policy to display information about Web cache policies.
Syntax
In standalone mode:
display cache-policy [ name cache-policy-name ] [ slot slot-number cpu cpu-number ]
In IRF mode:
display cache-policy [ name cache-policy-name ] [ chassis chassis-number slot slot-number cpu cpu-number ]
Views
Any view
Predefined user roles
network-admin
network-operator
context-admin
context-operator
Parameters
name cache-policy-name: Specifies a Web cache policy by its name, a case-insensitive string of 1 to 63 characters. If you do not specify a Web cache policy, this command displays information about all Web cache policies.
slot slot-number: Specifies a card by its slot number. If you do not specify a card, this command displays information about Web cache policies for all cards. (In standalone mode.)
chassis chassis-number slot slot-number: Specifies a card on an IRF member device. The chassis-number argument represents the member ID of the IRF member device. The slot-number argument represents the slot number of the card. If you do not specify this option, the command displays information about Web cache policies for all cards. (In IRF mode.)
cpu cpu-number: Specifies a CPU by its number.
Examples
# Display information about all Web cache policies.
<Sysname> display cache-policy
Policy name: cp1
Type: HTTP
Max size: 64 MB
Single file size: 2048 KB
Aging time: 60 min
Match rule:
match 1 uri /.*
match 2 uri /index.php
Reference count: 0
Slot 1:
File list:
Name Type Encoding Language Timeout Matches FileSize
-------------------------------------------------------------------------------
/index.php text/html deflate zh-cn 60 15 1200
Total files : 1
Table 1 Command output
Field |
Description |
Max size |
Maximum size allowed for all cached files. |
Single file size |
Maximum size allowed for a single cached file. |
Aging time |
Aging time configured for cached files. |
Reference count |
Times for which the Web cache policy is referenced. |
Timeout |
Amount of time in minutes before the aging timer of the file expires. |
FileSize |
Size of the file, in bytes. |
display cache-policy statistics
Use display cache-policy statistics to display statistics for Web cache policies.
Syntax
display cache-policy statistics [ name cache-policy-name ]
Views
Any view
Predefined user roles
network-admin
network-operator
context-admin
context-operator
Parameters
name cache-policy-name: Specifies a Web cache policy by its name, a case-insensitive string of 1 to 63 characters. If you do not specify a Web cache policy, this command displays statistics for all Web cache policies.
Examples
# Display statistics for all Web cache policies.
<Sysname> display cache-policy statistics
Slot 2:
Cache policy: cp1
Matching requests: 0
Cache policy: cp2
Matching requests: 3
file-max-size
Use file-max-size to set the maximum size of a single cached file.
Use undo file-max-size to restore the default.
Syntax
file-max-size file-size
undo file-max-size
Default
The maximum size of a single cached file is 2048 KB.
Views
Web cache policy view
Predefined user roles
network-admin
context-admin
Parameters
file-size: Specifies the maximum size for a single cached file, in the range of 1 to 4096 KB.
Examples
# Set the maximum size of a single cached file to 180 KB in HTTP Web cache policy cp1.
<Sysname> system-view
[Sysname] cache-policy cp1 type http
[Sysname-cp-http-cp1] file-max-size 180
match uri
Use match uri to create a URI match rule or modify an existing URI match rule.
Use undo match to delete a URI match rule.
Syntax
match [ match-id ] uri uri
undo match match-id
Default
No URI match rules exist.
Views
Web cache policy view
Predefined user roles
network-admin
context-admin
Parameters
match-id: Specifies a match rule ID in the range of 1 to 65535. If you do not specify a match rule ID, the system automatically assigns the smallest available ID, with the step as 1.
uri uri: Specifies a URI regular expression, a case-insensitive string of 1 to 255 characters. The question mark (?) is not supported.
Usage guidelines
You can create a maximum of 65535 match rules for a Web cache policy.
Examples
# Create a URI match rule to match all URIs in HTTP Web cache policy cp1.
<Sysname> system-view
[Sysname] cache-policy policy cp1 type http
[Sysname-cp-http-cp1] match 1 uri /.*
reset cache-policy
Use reset cache-policy to clear cached files for Web cache policies.
Syntax
reset cache-policy [ cache-policy-name ]
Views
User view
Predefined user roles
network-admin
context-admin
Parameters
cache-policy-name: Specifies a Web cache policy by its name, a case-insensitive string of 1 to 63 characters. If you do not specify a Web cache policy, this command clears cached files for all Web cache policies.
Examples
# Clear cached files for all HTTP Web cache policies.
<Sysname> reset cache-policy
reset cache-policy statistics
Use reset cache-policy statistics to clear statistics for Web cache policies.
Syntax
reset cache-policy statistics [ cache-policy-name ]
Views
Any view
Predefined user roles
network-admin
context-admin
Parameters
cache-policy-name: Specifies a Web cache policy by its name, a case-insensitive string of 1 to 63 characters. If you do not specify a Web cache policy, this command clears statistics for all Web cache policies.
Examples
# Clear statistics for all HTTP Web cache policies.
<Sysname> reset cache-policy statistics
size
Use size to set the maximum size for cached files.
Use undo size to restore the default.
Syntax
size size-value
undo size
Default
The maximum size for cached files is 64 MB.
Views
Web cache policy view
Predefined user roles
network-admin
context-admin
Parameters
size-value: Specifies the maximum size for cached files, in the range of 8 to 64 MB.
Examples
# Set the maximum size for cached files to 32 MB in HTTP Web cache policy cp1.
<Sysname> system-view
[Sysname] cache-policy cp1 type http
[Sysname-cp-http-cp1] size 32