Applicable in ObjectType-class directives.
The cache_enable function tells the proxy that an object is cacheable, based on specific criteria. As an example, if the function appears in the object <Object ppath="http://.*">, then all the HTTP documents are considered cacheable, as long as other conditions for an object to be cacheable are met.
ObjectType fn=cache-enable cache-auth=0|1 query-maxlen=number min-size=number max-size=number log-report=feature cache-local=0|1
The following table describes the parameter for the cache-enable function.
Table 5–74 cache-enable Parameters
Parameter |
Description |
---|---|
cache-enable |
Tells the proxy that an object is cacheable. As an example, if it appears in the object <Object ppath="http://.*">, then all HTTP documents are considered cacheable as long as other conditions for an object to be cacheable are met. |
cache-auth |
Specifies whether to cache items that require authentication. If set to 1, pages that require authentication can be cached also. If not specified, defaults to 0. |
query-maxlen |
Specifies the number of characters in the query string the “?string” part at the end of the URL that are still cacheable. The same queries are rarely repeated exactly in the same form by more than one user, and so caching them is often not desirable. That’s why the default is 0. |
min-size |
The minimum size, in kilobytes, of any document to be cached. The benefits of caching are greatest with the largest documents. For this reason, some people prefer to cache only larger documents. |
max-size |
The maximum size in kilobytes of any document to be cached. This setting allows users to limit the maximum size of cached documents, so no single document can take up too much space. |
log-report |
Used to control the feature that reports local cache accesses back to the origin server so that content providers get their true access logs. |
cache-local |
Used to enable local host caching, that is, URLs without fully qualified domain names, in the proxy. If set to 1, local hosts are cached. If not specified, it defaults to 0, and local hosts are not cached. |
The following example of cache-enable allows you to enable caching of objects matching the current resource. This function applies to normal, non-query, non-authenticated documents of any size. The proxy requires that the document carries either last-modified or expires headers or both, and that the content-type reported by the origin server is accurate.
ObjectType fn=cache-enable
The example below is like the first example, but it also caches documents that require user authentication, and it caches queries up to five characters long. The cache-auth=1 indicates that an up-to-date check is always required for documents that need user authentication. This function forces authentication again.
ObjectType fn=cache-enable cache-auth=1 query-maxlen=5
The example below is also like the first example, except that it limits the size of cache files to a range of 2 Kbytes to 1 Mbytes.
ObjectType fn=cache-enable min-size=2 max-size=1000