cache-setting
Applicable in ObjectType-class directives.
cache-setting is an ObjectType function
that sets parameters used for cache control.
This function is used to explicitly cache (or not cache) a resource,
create an object for that resource, and set the caching parameters for the
object.
Syntax
ObjectType fn=cache-setting
max-uncheck=seconds
lm-factor=factor connect-mode=always|fast-demo|never
cover-errors=number
Parameters
The following table describes parameters for the cache-setting function.
Table 5–68 cache-setting parameters
Parameter
|
Description
|
max-uncheck
|
(Optional) is the maximum time in seconds, allowed between consecutive
up-to-date checks. If set to 0 (default), a check is made every time the document
is accessed, and the lm-factor has no effect.
|
lm-factor
|
(optional)A floating point number representing the factor used in estimating
expiration time (how long a document might be up to date based on the time
it was last modified). The time elapsed since the last modification is multiplied
by this factor, and the result gives the estimated time the document is likely
to remain unchanged. Specifying a value of 0 turns off this function, and
then the caching system uses only explicit expiration information (rarely
available). Only explicit Expires HTTP headers are used. This value has no
effect if max-uncheck is set to 0.
|
connect-mode
|
Specifies network connectivity and can be set to these values:
-
always (default) connects to remote servers
when necessary.
-
fast-demo connects only if the item isn’t
found in the cache.
-
never no connection to a remote server
is ever made; returns an error if the document is not found in the cache.
|
cover-errors
|
If present and greater than 0, returns a document from the cache if
the remote server is down and an up-to-date check cannot be made. The value
specified is the maximum number of seconds since the last up-to-date check;
if more time has elapsed, an error is returned. Using this feature involves
the risk of getting stale data from the cache while the remote server is down.
Setting this value to 0, or not specifying it (default) causes an error to
be returned if the remote server is unavailable.
|
term-percent
|
means to keep retrieving if more than the specified percentage of the
document has already been retrieved.
|
Example
<Object ppath="http://.*">
ObjectType fn=cache-enable
ObjectType fn=cache-setting max-uncheck="7200"
ObjectType fn=cache-setting lm-factor="0.020"
ObjectType fn=cache-setting connect-mode="fast-demo"
ObjectType fn=cache-setting cover-errors="3600"
Service fn=proxy-retrieve
</Object>
# Force check every time
ObjectType fn=cache-setting max-uncheck=0
# Check every 30 minutes, or sooner if changed less than
# 6 hours ago (factor 0.1; last change 1 hour ago would
# give 6-minute maximum check interval).
ObjectType fn=cache-setting max-uncheck=1800 lm-factor=0.1
# Disable caching of the current resource
ObjectType fn=cache-setting cache-mode=nothing
|