Apache HTTP Server Version 2.4
Description: | RFC 2616 compliant HTTP caching filter. |
---|---|
Status: | Extension |
Module Identifier: | cache_module |
Source File: | mod_cache.c |
CacheQuickHandler
directive is
in its default value of on, the Allow
and Deny
directives will be circumvented.
You should not enable quick handler caching for any content to which you
wish to limit access by client host name, address or environment
variable.mod_cache
implements an RFC 2616 compliant
HTTP content caching filter, with support for the caching
of content negotiated responses containing the Vary header.
RFC 2616 compliant caching provides a mechanism to verify whether stale or expired content is still fresh, and can represent a significant performance boost when the origin server supports conditional requests by honouring the If-None-Match HTTP request header. Content is only regenerated from scratch when the content has changed, and not when the cached entry expires.
As a filter, mod_cache
can be placed in front of
content originating from any handler, including flat
files (served from a slow disk cached on a fast disk), the output
of a CGI script or dynamic content
generator, or content proxied from another
server.
In the default configuration, mod_cache
inserts the
caching filter as far forward as possible within the filter stack,
utilising the quick handler to bypass all per request
processing when returning content to the client. In this mode of
operation, mod_cache
may be thought of as a caching
proxy server bolted to the front of the webserver, while running within
the webserver itself.
When the quick handler is switched off using the
CacheQuickHandler
directive,
it becomes possible to insert the CACHE filter at a
point in the filter stack chosen by the administrator. This provides the
opportunity to cache content before that content is personalised by the
mod_include
filter, or optionally compressed by the
mod_deflate
filter.
Under normal operation, mod_cache
will respond to
and can be controlled by the
Cache-Control
and
Pragma
headers sent from a client in a request, or from a
server within a response. Under exceptional circumstances,
mod_cache
can be configured to override these headers
and force site specific behaviour, however such behaviour will be limited
to this cache only, and will not affect the operation of other caches
that may exist between the client and server, and as a result is not
recommended unless strictly necessary.
RFC 2616 allows for the cache to return stale data while the existing
stale entry is refreshed from the origin server, and this is supported
by mod_cache
when the
CacheLock
directive is suitably
configured. Such responses will contain a
Warning
HTTP header with a 110 response code. RFC 2616 also allows a cache to return
stale data when the attempt made to refresh the stale data returns an
error 500 or above, and this behaviour is supported by default by
mod_cache
. Such responses will contain a
Warning
HTTP header with a 111 response code.
mod_cache
requires the services of one or more
storage management modules. The following storage management modules are included in
the base Apache distribution:
mod_cache_disk
htcacheclean
tool is
provided to list cached URLs, remove cached URLs, or to maintain the size
of the disk cache within size and inode limits.mod_cache_socache
Further details, discussion, and examples, are provided in the Caching Guide.