Skip to content

cache policy

The following operations can be performed on "cache policy":

add | rm | set | unset | show | stat | rename

add cache policy

Creates an integrated caching policy. The newly created policy is in inactive state. To activate the policy, use the bind cache global command.

Synopsys

add cache policy <policyName> -rule <expression> -action <action> [-storeInGroup <string>] [-invalGroups <string> ...] [-invalObjects <string> ...] [-undefAction ( NOCACHE | RESET )]

Arguments

policyName

Name for the policy. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. Can be changed after the policy is created.

rule

Expression against which the traffic is evaluated.

Note:

Maximum length of a string literal in the expression is 255 characters. A longer string can be split into smaller strings of up to 255 characters each, and the smaller strings concatenated with the + operator. For example, you can create a 500-character string as follows: '"<string of 255 characters>" + "<string of 245 characters>"'

The following requirements apply only to the NetScaler CLI:

  • If the expression includes one or more spaces, enclose the entire expression in double quotation marks.

  • If the expression itself includes double quotation marks, escape the quotations by using the \ character.

  • Alternatively, you can use single quotation marks to enclose the rule, in which case you do not have to escape the double quotation marks.

action

Action to apply to content that matches the policy.

  • CACHE or MAY_CACHE action - positive cachability policy

  • NOCACHE or MAY_NOCACHE action - negative cachability policy

  • INVAL action - Dynamic Invalidation Policy

Possible values: CACHE, NOCACHE, MAY_CACHE, MAY_NOCACHE, INVAL

storeInGroup

Name of the content group in which to store the object when the final result of policy evaluation is CACHE. The content group must exist before being mentioned here. Use the "show cache contentgroup" command to view the list of existing content groups.

invalGroups

Content group(s) to be invalidated when the INVAL action is applied. Maximum number of content groups that can be specified is 16.

invalObjects

Content groups(s) in which the objects will be invalidated if the action is INVAL.

undefAction

Action to be performed when the result of rule evaluation is undefined.

Possible values: NOCACHE, RESET

rm cache policy

Removes the specified caching policy. Make sure that the policy is not bound globally or to a virtual server. A bound policy cannot be removed.

Synopsys

rm cache policy <policyName>

Arguments

policyName

Name of the cache policy to be removed.

set cache policy

Modifies the specified attributes of an existing cache policy. The rule, flow type, can be changed only if action and undefAction (if present) are of NEUTRAL flow type.

Synopsys

set cache policy <policyName> [-rule <expression>] [-action <action>] [-storeInGroup <string>] [-invalGroups <string> ...] [-invalObjects <string> ...] [-undefAction ( NOCACHE | RESET )]

Arguments

policyName

Name for the policy. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. Can be changed after the policy is created.

rule

Expression against which the traffic is evaluated.

Note:

Maximum length of a string literal in the expression is 255 characters. A longer string can be split into smaller strings of up to 255 characters each, and the smaller strings concatenated with the + operator. For example, you can create a 500-character string as follows: '"<string of 255 characters>" + "<string of 245 characters>"'

The following requirements apply only to the NetScaler CLI:

  • If the expression includes one or more spaces, enclose the entire expression in double quotation marks.

  • If the expression itself includes double quotation marks, escape the quotations by using the \ character.

  • Alternatively, you can use single quotation marks to enclose the rule, in which case you do not have to escape the double quotation marks.

action

Action to apply to content that matches the policy.

  • CACHE or MAY_CACHE action - positive cachability policy

  • NOCACHE or MAY_NOCACHE action - negative cachability policy

  • INVAL action - Dynamic Invalidation Policy

Possible values: CACHE, NOCACHE, MAY_CACHE, MAY_NOCACHE, INVAL

storeInGroup

Name of the content group in which to store the object when the final result of policy evaluation is CACHE. The content group must exist before being mentioned here. Use the "show cache contentgroup" command to view the list of existing content groups.

invalGroups

Content group(s) to be invalidated when the INVAL action is applied. Maximum number of content groups that can be specified is 16.

invalObjects

Content groups(s) in which the objects will be invalidated if the action is INVAL.

undefAction

Action to be performed when the result of rule evaluation is undefined.

Possible values: NOCACHE, RESET

Example

set cache policy pol9 -rule "http.req.HEADER(\\"header\\").CONTAINS(\\"qh2\\")"

unset cache policy

Use this command to remove cache policy settings.Refer to the set cache policy command for meanings of the arguments.

Synopsys

unset cache policy <policyName> [-storeInGroup] [-invalGroups] [-invalObjects] [-undefAction]

show cache policy

Displays all configured cache policies. To display details about a particular cache policy, specify the name of the policy. When all caching policies are displayed, the order of the displayed policies within each group is the same as the evaluation order of the policies. There are three groups: request policies, response policies, and dynamic invalidation policies.

Synopsys

show cache policy [<policyName>]show cache policy stats - alias for 'stat cache policy'

Arguments

policyName

Name of the cache policy about which to display details.

Outputs

stateflag

rule

The request/response rule that will trigger the specified action.

action

The integrated cache action to be applied when the system sees content that matches the rules.

storeInGroup

The content group that will store the object when the action directive is CACHE.

invalGroups

The content group(s) to be invalidated when the action directive is INVAL.

invalObjects

The content group(s) whose objects will be invalidated when the action directive is INVAL.

priority

Priority.

hits

Hits.

undefAction

A CACHE action, to be used by the policy when the rule evaluation turns out to be undefined.

undefHits

Number of Undef hits.

flags

Flag.

precedeDefRules

Override default request/response cacheability rules.

activePolicy

Indicates whether policy is bound or not.

boundTo

Location where policy is bound

gotoPriorityExpression

Expression specifying the priority of the next policy which will get evaluated if the current policy rule evaluates to TRUE.

labelType

Type of policy label invocation.

labelName

Name of the label to invoke if the current policy rule evaluates to TRUE.

bindPolicyType

vserverType

builtin

devno

count

stat cache policy

Displays a summary of cache policy statistics.

Synopsys

stat cache policy [<policyName>] [-detail] [-fullValues] [-ntimes <positive_integer>] [-logFile <input_filename>] [-clearstats ( basic | full )]

Arguments

policyName

Name of the cache policy for which to display statistics. If you do not set this parameter, statistics are shown for all cache policies.

detail

Specifies detailed output (including more statistics). The output can be quite voluminous. Without this argument, the output will show only a summary.

fullValues

Specifies that numbers and strings should be displayed in their full form. Without this option, long strings are shortened and large numbers are abbreviated

ntimes

The number of times, in intervals of seven seconds, the statistics should be displayed.

Default value: 1

Minimum value: 0

logFile

The name of the log file to be used as input.

clearstats

Clear the statsistics / counters

Possible values: basic, full

Outputs

count

devno

stateflag

Outputs

Policy hits (Hits)

Number of hits on the policy

Policy undef hits (Undefhits)

Number of undef hits on the policy

Example

stat cache policy

rename cache policy

Renames an existing cache policy.

Synopsys

rename cache policy <policyName>@ <newName>@

Arguments

policyName

Existing name of the cache policy.

newName

New name for the cache policy. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.

Example

rename cache policy oldname newname

Was this article helpful?