mod_cache.html.en revision 88c775368960b64afcdfd93a812f466a109746ba
<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><!--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
--><title>mod_cache - Apache HTTP Server</title><link href="/style/manual.css" type="text/css" rel="stylesheet"></head><body><blockquote><div align="center"><img src="/images/sub.gif" alt="[APACHE DOCUMENTATION]"><h3>Apache HTTP Server Version 2.0</h3></div><h1 align="center">Apache Module mod_cache</h1><table cellspacing="1" cellpadding="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td nowrap="nowrap" valign="top"><span class="help">Description:
</span></td><td>Content cache keyed to URIs.</td></tr><tr><td nowrap="nowrap"><a href="module-dict.html#Status" class="help">Status:
</a></td><td>Experimental</td></tr><tr><td nowrap="nowrap"><a href="module-dict.html#ModuleIdentifier" class="help">Module&nbsp;Identifier:
</a></td><td>cache_module</td></tr></table></td></tr></table><h2>Summary</h2>
<blockquote><table><tr><td bgcolor="#ffe5f5">
This module is experimental. Documentation is still under development...
</td></tr></table></blockquote>
<p>mod_cache implements an RFC 2616 compliant HTTP content
cache that can be used to cache either local or proxied content.
mod_cache requires the services of one or more storage
management modules. Two storage management modules are included in
the base Apache distribution:</p>
<dl>
<dt><em><code><a href="/mod/mod_disk_cache.html">mod_disk_cache</a></code></em></dt>
<dd>implements a disk based storage manager for use with <code><a href="/mod/mod_proxy.html">mod_proxy</a></code></dd>
<dt><em><code><a href="/mod/mod_mem_cache.html">mod_mem_cache</a></code></em></dt>
<dd>implements an in-memory based storage manager. mod_mem_cache
can be configured to operate in two modes: caching open file
descriptors or caching objects in heap storage. <em><code><a href="/mod/mod_mem_cache.html">mod_mem_cache</a></code></em>
is most useful when used to cache locally generated content or to cache
backend server content for mod_proxy configured for ProxyPass (aka <em>reverse proxy</em>)</dd>
</dl>
<p>Content stored and retrived keyed to the URL. Content with
access protections is not cached.</p>
<h2>Directives</h2><ul><li><a href="#cachedefaultexpire">CacheDefaultExpire</a></li><li><a href="#cachedisable">CacheDisable</a></li><li><a href="#cacheenable">CacheEnable</a></li><li><a href="#cacheforcecompletion">CacheForceCompletion</a></li><li><a href="#cacheforcecompletion">CacheForceCompletion</a></li><li><a href="#cacheignorecachecontrol">CacheIgnoreCacheControl</a></li><li><a href="#cacheignorenolastmod">CacheIgnoreNoLastMod</a></li><li><a href="#cachelastmodifiedfactor">CacheLastModifiedFactor</a></li><li><a href="#cachemaxexpire">CacheMaxExpire</a></li><li><a href="#cacheon">CacheOn</a></li></ul><h2><a name="related">Related Modules and Directives</a></h2>
<table border="1"><tr><td valign="top"><strong>Related Modules</strong><br><br><code><a href="/mod/mod_disk_cache.html">mod_disk_cache</a></code><br><code><a href="/mod/mod_mem_cache.html">mod_mem_cache</a></code><br></td><td valign="top"><strong>Related Directives</strong><br><br><a href="/mod/mod_disk_cache.html#cacheroot" class="directive"><code class="directive">CacheRoot</code></a><br><a href="/mod/mod_disk_cache.html#cachesize" class="directive"><code class="directive">CacheSize</code></a><br><a href="/mod/mod_disk_cache.html#cachegcinterval" class="directive"><code class="directive">CacheGcInterval</code></a><br><a href="/mod/mod_disk_cache.html#cachedirlevels" class="directive"><code class="directive">CacheDirLevels</code></a><br><a href="/mod/mod_disk_cache.html#cachedirlength" class="directive"><code class="directive">CacheDirLength</code></a><br><a href="/mod/mod_disk_cache.html#cacheexpirycheck" class="directive"><code class="directive">CacheExpiryCheck</code></a><br><a href="/mod/mod_disk_cache.html#cacheminfilesize" class="directive"><code class="directive">CacheMinFileSize</code></a><br><a href="/mod/mod_disk_cache.html#cachemaxfilesize" class="directive"><code class="directive">CacheMaxFileSize</code></a><br><a href="/mod/mod_disk_cache.html#cachetimemargin" class="directive"><code class="directive">CacheTimeMargin</code></a><br><a href="/mod/mod_disk_cache.html#cachegcdaily" class="directive"><code class="directive">CacheGcDaily</code></a><br><a href="/mod/mod_disk_cache.html#cachegcunused" class="directive"><code class="directive">CacheGcUnused</code></a><br><a href="/mod/mod_disk_cache.html#cachegcclean" class="directive"><code class="directive">CacheGcClean</code></a><br><a href="/mod/mod_disk_cache.html#cachegcmemusage" class="directive"><code class="directive">CacheGcMemUsage</code></a><br><a href="/mod/mod_mem_cache.html#mcachesize" class="directive"><code class="directive">MCacheSize</code></a><br><a href="/mod/mod_mem_cache.html#mcachemaxobjectcount" class="directive"><code class="directive">MCacheMaxObjectCount</code></a><br><a href="/mod/mod_mem_cache.html#mcacheminobjectsize" class="directive"><code class="directive">MCacheMinObjectSize</code></a><br><a href="/mod/mod_mem_cache.html#mcachemaxobjectsize" class="directive"><code class="directive">MCacheMaxObjectSize</code></a><br><a href="/mod/mod_mem_cache.html#mcacheremovalalgorithm" class="directive"><code class="directive">MCacheRemovalAlgorithm</code></a><br></td></tr></table>
<h2>Sample Configuration</h2>
<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><p align="center"><strong>Sample httpd.conf</strong></p><code>
# <br>
# Sample Cache Configuration <br>
# <br>
LoadModule cache_module modules/mod_cache.so <br>
&lt;IfModule mod_cache.c&gt;<br>
CacheOn On<br>
<p></p>
#LoadModule disk_cache_module modules/mod_disk_cache.so <br>
&lt;IfModule mod_disk_cache.c&gt; <br>
CacheRoot c:/cacheroot <br>
CacheSize 256 <br>
CacheEnable disk / <br>
CacheDirLevels 5 <br>
CacheDirLength 3 <br>
&lt;/IfModule&gt; <br>
<p></p>
LoadModule mem_cache_module modules/mod_mem_cache.so <br>
&lt;IfModule mod_mem_cache.c&gt; <br>
MCacheEnable mem / <br>
MCacheSize 4096 <br>
MCacheMaxObjectCount 100 <br>
MCacheMinObjectSize 1 <br>
MCacheMaxObjectSize 2048 <br>
&lt;/IfModule&gt; <br>
<p></p>
&lt;/IfModule&gt; <br>
</code></td></tr></table></blockquote>
<hr><h2><a name="CacheDefaultExpire">CacheDefaultExpire</a> <a name="cachedefaultexpire">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td nowrap="nowrap"><strong>Description:
</strong></td><td></td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Syntax" class="help">Syntax:
</a></td><td>CacheDefaultExpire <em>seconds</em></td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Default" class="help">Default:
</a></td><td><code>CacheDefaultExpire 3600 (one hour)</code></td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Context" class="help">Context:
</a></td><td>server config</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Status" class="help">Status:
</a></td><td>Experimental</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Module" class="help">Module:
</a></td><td>mod_cache</td></tr></table></td></tr></table>
<p>The default time in seconds to cache a document if the page does not have
an expiry date in the <em>Expires</em> field.</p>
<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
CacheDefaultExpire 86400
</code></td></tr></table></blockquote>
<hr><h2><a name="CacheDisable">CacheDisable</a> <a name="cachedisable">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td nowrap="nowrap"><strong>Description:
</strong></td><td>Disable caching of specified URLs by specified storage manager</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Syntax" class="help">Syntax:
</a></td><td>CacheDisable <em>cache_type </em> <em> url-string</em></td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Context" class="help">Context:
</a></td><td>server config</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Status" class="help">Status:
</a></td><td>Experimental</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Module" class="help">Module:
</a></td><td>mod_cache</td></tr></table></td></tr></table>
<p>The <code class="directive">CacheDisable</code> directive instructs
mod_cache to <em>not</em> cache urls at or above <em>url-string</em>.</p>
<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><p align="center"><strong>Example</strong></p><code>
CacheDisable disk /local_files
</code></td></tr></table></blockquote>
<hr><h2><a name="CacheEnable">CacheEnable</a> <a name="cacheenable">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td nowrap="nowrap"><strong>Description:
</strong></td><td>Enable caching specified URLs in a specified storage manager</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Syntax" class="help">Syntax:
</a></td><td>CacheEnable <em>cache_type </em><em> url-string</em></td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Context" class="help">Context:
</a></td><td>server config</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Status" class="help">Status:
</a></td><td>Experimental</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Module" class="help">Module:
</a></td><td>mod_cache</td></tr></table></td></tr></table>
<p>The <code class="directive">CacheEnable</code> directive instructs
mod_cache to cache urls at or below <em>url-string</em>.
The cache store is specified with the <em>cache_type</em> argument.
<em>cache_type </em> <em> mem</em> instructs mod_cache to use the
in-memory cache storage manager implemented by <em>mod_mem_cache</em>.
<em>cache_type </em> <em> disk</em> instructs mod_cache to use the
cache storage manager implemented by <em>mod_disk_cache </em>. </p>
<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
CacheEnable disk / <br>
CacheEnable mem /manual <br>
CacheEnable fd /images <br>
</code></td></tr></table></blockquote>
<hr><h2><a name="CacheForceCompletion">CacheForceCompletion</a> <a name="cacheforcecompletion">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td nowrap="nowrap"><strong>Description:
</strong></td><td>Percentage of download to arrive for the cache to force complete transfert</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Syntax" class="help">Syntax:
</a></td><td>CacheLastModifiedFactor <em>Percentage</em></td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Default" class="help">Default:
</a></td><td><code>CacheLastModifiedFactor 60</code></td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Context" class="help">Context:
</a></td><td>server config</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Status" class="help">Status:
</a></td><td>Experimental</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Module" class="help">Module:
</a></td><td>mod_cache</td></tr></table></td></tr></table>
<p>Percentage of download to arrive for the cache to force complete transfert.</p>
<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
CacheForceCompletion
</code></td></tr></table></blockquote>
<blockquote><table><tr><td bgcolor="#ffe5f5">
This feature is currently <em>not</em> implemented.
</td></tr></table></blockquote>
<hr><h2><a name="CacheForceCompletion">CacheForceCompletion</a> <a name="cacheforcecompletion">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td nowrap="nowrap"><strong>Description:
</strong></td><td>Percentage of download to arrive for the cache to force complete transfert</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Syntax" class="help">Syntax:
</a></td><td>CacheLastModifiedFactor <em>Percentage</em></td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Default" class="help">Default:
</a></td><td><code>CacheLastModifiedFactor 60</code></td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Context" class="help">Context:
</a></td><td>server config</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Status" class="help">Status:
</a></td><td>Experimental</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Module" class="help">Module:
</a></td><td>mod_cache</td></tr></table></td></tr></table>
<p>Percentage of download to arrive for the cache to force complete transfert.</p>
<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
CacheForceCompletion
</code></td></tr></table></blockquote>
<blockquote><table><tr><td bgcolor="#ffe5f5">
This feature is currently <em>not</em> implemented.
</td></tr></table></blockquote>
<hr><h2><a name="CacheIgnoreCacheControl">CacheIgnoreCacheControl</a> <a name="cacheignorecachecontrol">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td nowrap="nowrap"><strong>Description:
</strong></td><td>Ignore requests from the client for uncached content</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Syntax" class="help">Syntax:
</a></td><td>CacheIgnoreCacheControl</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Context" class="help">Context:
</a></td><td>server config</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Status" class="help">Status:
</a></td><td>Experimental</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Module" class="help">Module:
</a></td><td>mod_cache</td></tr></table></td></tr></table>
<p>Ignore requests from the client for uncached content</p>
<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
CacheIgnoreNoLastMod
</code></td></tr></table></blockquote>
<hr><h2><a name="CacheIgnoreNoLastMod">CacheIgnoreNoLastMod</a> <a name="cacheignorenolastmod">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td nowrap="nowrap"><strong>Description:
</strong></td><td>Ignore responses where there is no Last Modified Header</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Syntax" class="help">Syntax:
</a></td><td>CacheIgnoreNoLastMod</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Context" class="help">Context:
</a></td><td>server config</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Status" class="help">Status:
</a></td><td>Experimental</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Module" class="help">Module:
</a></td><td>mod_cache</td></tr></table></td></tr></table>
<p>Ignore responses where there is no Last Modified Header</p>
<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
CacheIgnoreNoLastMod
</code></td></tr></table></blockquote>
<hr><h2><a name="CacheLastModifiedFactor">CacheLastModifiedFactor</a> <a name="cachelastmodifiedfactor">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td nowrap="nowrap"><strong>Description:
</strong></td><td>The factor used to estimate the Expires date from the LastModified date</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Syntax" class="help">Syntax:
</a></td><td>CacheLastModifiedFactor <em>float</em></td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Default" class="help">Default:
</a></td><td><code>CacheLastModifiedFactor 0.1</code></td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Context" class="help">Context:
</a></td><td>server config</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Status" class="help">Status:
</a></td><td>Experimental</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Module" class="help">Module:
</a></td><td>mod_cache</td></tr></table></td></tr></table>
<p>The factor used to estimate the Expires date from the LastModified date.</p>
<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
CacheLastModifiedFactor
</code></td></tr></table></blockquote>
<hr><h2><a name="CacheMaxExpire">CacheMaxExpire</a> <a name="cachemaxexpire">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td nowrap="nowrap"><strong>Description:
</strong></td><td>The maximum time in seconds to cache a document</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Syntax" class="help">Syntax:
</a></td><td>CacheMaxExpire <em>seconds</em></td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Default" class="help">Default:
</a></td><td><code>CacheMaxExpire 86400 (one day)</code></td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Context" class="help">Context:
</a></td><td>server config</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Status" class="help">Status:
</a></td><td>Experimental</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Module" class="help">Module:
</a></td><td>mod_cache</td></tr></table></td></tr></table>
<p>The maximum time in seconds to cache a document. The <code class="directive">CacheMaxExpire</code>
takes precedence over the <em>Expire</em> field from the header.</p>
<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
CacheMaxExpire 604800
</code></td></tr></table></blockquote>
<hr><h2><a name="CacheOn">CacheOn</a> <a name="cacheon">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td nowrap="nowrap"><strong>Description:
</strong></td><td></td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Syntax" class="help">Syntax:
</a></td><td>CacheOn</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Context" class="help">Context:
</a></td><td>server config</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Status" class="help">Status:
</a></td><td>Experimental</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Module" class="help">Module:
</a></td><td>mod_cache</td></tr></table></td></tr></table>
<p>
</p>
<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
CacheOn
</code></td></tr></table></blockquote>
<hr></blockquote><h3 align="center">Apache HTTP Server Version 2.0</h3><a href="./"><img src="/images/index.gif" alt="Index"></a><a href="../"><img src="/images/home.gif" alt="Home"></a></body></html>