CACHE::userkey¶
Description¶
Allows users to add user-defined values to the key used by the cache
to reference the cached content.
Cached content by default is stored with a unique key referring to
both the URI of the resource to be cached and the User-Agent for which
it was formatted. If multiple variations of the same content must be
cached under specific conditions (different client), you can use this
command to create a unique key, thus creating cached content specific
to that condition. This can be used to prevent one user or group’s
cached data from being served to different users/groups.
For example, you can use this command to store different cached
content for dialup and broadband by using the MTU as a user-defined
key string, or to cache different sets of content for internal and
external clients.
Syntax¶
CACHE::userkey <key>
CACHE::userkey <key>¶
- Allows users to add user-defined values to the key, according to the specified key string, overriding the default User-Agent key.
Examples¶
This will put all internal requests into a single cache group, and
external requests into another.
when HTTP_REQUEST {
if {[matchclass [IP::client_addr] equals $::InternalIPs]} {
CACHE::userkey “Internal”
} else {
CACHE::userkey “External”
}
}
This will put all requests into the same cache group:
when HTTP_REQUEST {
CACHE::userkey "ALL"
}