mod_cache.xml revision 89ebbccde2b87b469b9d6fdb606eeb943c12a824
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<!-- $LastChangedRevision$ -->
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell Copyright 2002-2005 The Apache Software Foundation or its licensors, as
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell Licensed under the Apache License, Version 2.0 (the "License");
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell you may not use this file except in compliance with the License.
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell You may obtain a copy of the License at
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell Unless required by applicable law or agreed to in writing, software
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell distributed under the License is distributed on an "AS IS" BASIS,
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
c007849bbb809877e23d714ab629dea788abceddCraig McDonnell See the License for the specific language governing permissions and
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell limitations under the License.
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<modulesynopsis metafile="mod_cache.xml.meta">
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<description>Content cache keyed to URIs.</description>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <p><module>mod_cache</module> implements an <a
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a> compliant HTTP
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell content cache that can be used to cache either local or proxied content.
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <module>mod_cache</module> requires the services of one or more storage
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell management modules. Two storage management modules are included in
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell the base Apache distribution:</p>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <dd>implements a disk based storage manager.</dd>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <dd>implements a memory based storage manager.
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <module>mod_mem_cache</module> can be configured to operate in two
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell modes: caching open file descriptors or caching objects in heap storage.
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <module>mod_mem_cache</module> can be used to cache locally generated content
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell or to cache backend server content for <module>mod_proxy</module> when
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell configured using <directive module="mod_proxy">ProxyPass</directive>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <p>Content is stored in and retrieved from the cache using URI based keys. Content with
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell access protection is not cached.</p>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<section id="related"><title>Related Modules and Directives</title>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell </modulelist>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <directivelist>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <directive module="mod_disk_cache">CacheRoot</directive>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <directive module="mod_disk_cache">CacheSize</directive>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <directive module="mod_disk_cache">CacheDirLevels</directive>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <directive module="mod_disk_cache">CacheDirLength</directive>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <directive module="mod_disk_cache">CacheMinFileSize</directive>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <directive module="mod_disk_cache">CacheMaxFileSize</directive>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <directive module="mod_mem_cache">MCacheSize</directive>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <directive module="mod_mem_cache">MCacheMaxObjectCount</directive>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <directive module="mod_mem_cache">MCacheMinObjectSize</directive>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <directive module="mod_mem_cache">MCacheMaxObjectSize</directive>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <directive module="mod_mem_cache">MCacheRemovalAlgorithm</directive>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <directive module="mod_mem_cache">MCacheMaxStreamingBuffer</directive>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell </directivelist>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<section id="sampleconf"><title>Sample Configuration</title>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell # Sample Cache Configuration<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell LoadModule cache_module modules/mod_cache.so<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell #LoadModule disk_cache_module modules/mod_disk_cache.so<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell # If you want to use mod_disk_cache instead of mod_mem_cache,<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell # uncomment the line above and comment out the LoadModule line below.<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell CacheRoot c:/cacheroot<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell CacheEnable disk /<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell CacheDirLevels 5<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell CacheDirLength 3<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell </IfModule> <br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell LoadModule mem_cache_module modules/mod_mem_cache.so<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell CacheEnable mem /<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell MCacheSize 4096<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell MCacheMaxObjectCount 100<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell MCacheMinObjectSize 1<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell MCacheMaxObjectSize 2048<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell </IfModule><br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell # When acting as a proxy, don't cache the list of security updates<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell CacheDisable http://security.update.server/update-list/<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell </IfModule>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<directivesynopsis>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<description>Enable caching of specified URLs using a specified storage
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnellmanager</description>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<syntax>CacheEnable <var>cache_type</var> <var>url-string</var></syntax>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<contextlist><context>server config</context><context>virtual host</context>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell</contextlist>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <p>The <directive>CacheEnable</directive> directive instructs
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <module>mod_cache</module> to cache urls at or below
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <var>url-string</var>. The cache storage manager is specified with the
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <var>cache_type</var> argument. <var>cache_type</var> <code> mem</code>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell instructs <module>mod_cache</module> to use the memory based storage
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell manager implemented by <module>mod_mem_cache</module>.
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <var>cache_type</var> <code>disk</code> instructs
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <module>mod_cache</module> to use the disk based storage manager
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell implemented by <module>mod_disk_cache</module>.
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <var>cache_type</var> <code>fd</code> instructs
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <module>mod_cache</module> to use the file descriptor cache implemented
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <p>In the event that the URL space overlaps between different
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <directive>CacheEnable</directive> directives (as in the example below),
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell each possible storage manager will be run until the first one that
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell actually processes the request. The order in which the storage managers are
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell run is determined by the order of the <directive>CacheEnable</directive>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell directives in the configuration file.</p>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell CacheEnable mem /manual<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell CacheEnable fd /images<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell CacheEnable disk /<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <p>When acting as a forward proxy server, <var>url-string</var> can
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell also be used to specify remote sites and proxy protocols which
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell caching should be enabled for.</p>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell # Cache proxied url's<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell # Cache FTP-proxied url's<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell CacheEnable disk http://www.apache.org/<br />
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell</directivesynopsis>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<directivesynopsis>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<description>Disable caching of specified URLs</description>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<syntax>CacheDisable <var> url-string</var></syntax>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<contextlist><context>server config</context><context>virtual host</context>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell</contextlist>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <p>The <directive>CacheDisable</directive> directive instructs
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <module>mod_cache</module> to <em>not</em> cache urls at or below
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell CacheDisable /local_files
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell</directivesynopsis>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<directivesynopsis>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<description>The maximum time in seconds to cache a document</description>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<syntax>CacheMaxExpire <var>seconds</var></syntax>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<default>CacheMaxExpire 86400 (one day)</default>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<contextlist><context>server config</context><context>virtual host</context>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell</contextlist>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <p>The <directive>CacheMaxExpire</directive> directive specifies the maximum number of
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell seconds for which cachable HTTP documents will be retained without checking the origin
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell server. Thus, documents will be out of date at most this number of seconds. This maximum
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell value is enforced even if an expiry date was supplied with the document.</p>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell CacheMaxExpire 604800
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell</directivesynopsis>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<directivesynopsis>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<description>The default duration to cache a document when no expiry date is specified.</description>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<syntax>CacheDefaultExpire <var>seconds</var></syntax>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<default>CacheDefaultExpire 3600 (one hour)</default>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<contextlist><context>server config</context><context>virtual host</context>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell</contextlist>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <p>The <directive>CacheDefaultExpire</directive> directive specifies a default time,
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell in seconds, to cache a document if neither an expiry date nor last-modified date are provided
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell with the document. The value specified with the <directive>CacheMaxExpire</directive>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell directive does <em>not</em> override this setting.</p>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell CacheDefaultExpire 86400
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell</directivesynopsis>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<directivesynopsis>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<description>Ignore the fact that a response has no Last Modified
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnellheader.</description>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<contextlist><context>server config</context><context>virtual host</context>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell</contextlist>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <p>Ordinarily, documents without a last-modified date are not cached.
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell Under some circumstances the last-modified date is removed (during
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <module>mod_include</module> processing for example) or not provided
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell at all. The <directive>CacheIgnoreNoLastMod</directive> directive
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell provides a way to specify that documents without last-modified dates
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell should be considered for caching, even without a last-modified date.
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell If neither a last-modified date nor an expiry date are provided with
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell the document then the value specified by the
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <directive>CacheDefaultExpire</directive> directive will be used to
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell generate an expiration date.</p>
014065ea14b5a1e46190cd2a6014945aea15689bCraig McDonnell CacheIgnoreNoLastMod On
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell</directivesynopsis>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<directivesynopsis>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<description>Ignore request to not serve cached content to client</description>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<syntax>CacheIgnoreCacheControl On|Off</syntax>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<default>CacheIgnoreCacheControl Off</default>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<contextlist><context>server config</context><context>virtual host</context>
014065ea14b5a1e46190cd2a6014945aea15689bCraig McDonnell</contextlist>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <p>Ordinarily, requests containing a Cache-Control: no-cache or
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell Pragma: no-cache header value will not be served from the cache. The
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <directive>CacheIgnoreCacheControl</directive> directive allows this
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell behavior to be overridden. <directive>CacheIgnoreCacheControl</directive>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell On tells the server to attempt to serve the resource from the cache even
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell if the request contains no-cache header values. Resources requiring
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell authorization will <em>never</em> be cached.</p>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell CacheIgnoreCacheControl On
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell <note type="warning"><title>Warning:</title>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell This directive will allow serving from the cache even if the client has
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell requested that the document not be served from the cache. This might
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell result in stale content being served.
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<seealso><directive module="mod_cache">CacheStorePrivate</directive></seealso>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<seealso><directive module="mod_cache">CacheStoreNoStore</directive></seealso>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell</directivesynopsis>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<directivesynopsis>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<description>The factor used to compute an expiry date based on the
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnellLastModified date.</description>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<syntax>CacheLastModifiedFactor <var>float</var></syntax>
455375d46179ba24afcd3662bdfb6aaf03a9479cCraig McDonnell<default>CacheLastModifiedFactor 0.1</default>