1
0
mirror of https://github.com/apache/httpd.git synced 2025-06-12 05:41:55 +03:00
Files
apache/docs/manual/mod/mod_cache.html.en
2002-10-07 15:23:03 +00:00

201 lines
20 KiB
XML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
--><title>mod_cache - Apache HTTP Server</title><link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /><link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /><link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link href="../images/favicon.ico" rel="shortcut icon" /></head><body><div id="page-header"><p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p><p class="apache">Apache HTTP Server Version 2.0</p><img alt="" src="../images/feather.gif" /></div><div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div><div id="path"><a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs-project/">Documentation</a> &gt; <a href="../">Version 2.0</a> &gt; <a href="./">Modules</a></div><div id="page-content"><div id="preamble"><h1>Apache Module mod_cache</h1><table class="module"><tr><th><a href="module-dict.html#Description">Description:
</a></th><td>Content cache keyed to URIs.</td></tr><tr><th><a href="module-dict.html#Status">Status:
</a></th><td>Experimental</td></tr><tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:
</a></th><td>cache_module</td></tr><tr><th><a href="module-dict.html#SourceFile">Source File:
</a></th><td>mod_cache.c</td></tr></table><h3>Summary</h3>
<div class="warning">
This module is experimental. Documentation is still under development...
</div>
<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><code class="module"><a href="../mod/mod_disk_cache.html">mod_disk_cache</a></code></dt>
<dd>implements a disk based storage manager for use with <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code></dd>
<dt><code class="module"><a href="../mod/mod_mem_cache.html">mod_mem_cache</a></code></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 class="module"><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>
</div><div id="quickview"><h3 class="directives">Directives</h3><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#cachedefaultexpire">CacheDefaultExpire</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#cachedisable">CacheDisable</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#cacheenable">CacheEnable</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#cacheforcecompletion">CacheForceCompletion</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#cacheignorecachecontrol">CacheIgnoreCacheControl</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#cacheignorenolastmod">CacheIgnoreNoLastMod</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#cachelastmodifiedfactor">CacheLastModifiedFactor</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#cachemaxexpire">CacheMaxExpire</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#cachemaxstreamingbuffer">CacheMaxStreamingBuffer</a></li>
</ul><h3>Topics</h3><ul id="topics"><li><img alt="" src="../images/down.gif" /> <a href="#related">Related Modules and Directives</a></li><li><img alt="" src="../images/down.gif" /> Sample Configuration</li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="related" id="related">Related Modules and Directives</a></h2>
<table class="related"><tr><th>Related Modules</th><th>Related Directives</th></tr><tr><td><ul><li><code class="module"><a href="../mod/mod_disk_cache.html">mod_disk_cache</a></code></li><li><code class="module"><a href="../mod/mod_mem_cache.html">mod_mem_cache</a></code></li></ul></td><td><ul><li><code class="directive"><a href="../mod/mod_disk_cache.html#cacheroot">CacheRoot</a></code></li><li><code class="directive"><a href="../mod/mod_disk_cache.html#cachesize">CacheSize</a></code></li><li><code class="directive"><a href="../mod/mod_disk_cache.html#cachegcinterval">CacheGcInterval</a></code></li><li><code class="directive"><a href="../mod/mod_disk_cache.html#cachedirlevels">CacheDirLevels</a></code></li><li><code class="directive"><a href="../mod/mod_disk_cache.html#cachedirlength">CacheDirLength</a></code></li><li><code class="directive"><a href="../mod/mod_disk_cache.html#cacheexpirycheck">CacheExpiryCheck</a></code></li><li><code class="directive"><a href="../mod/mod_disk_cache.html#cacheminfilesize">CacheMinFileSize</a></code></li><li><code class="directive"><a href="../mod/mod_disk_cache.html#cachemaxfilesize">CacheMaxFileSize</a></code></li><li><code class="directive"><a href="../mod/mod_disk_cache.html#cachetimemargin">CacheTimeMargin</a></code></li><li><code class="directive"><a href="../mod/mod_disk_cache.html#cachegcdaily">CacheGcDaily</a></code></li><li><code class="directive"><a href="../mod/mod_disk_cache.html#cachegcunused">CacheGcUnused</a></code></li><li><code class="directive"><a href="../mod/mod_disk_cache.html#cachegcclean">CacheGcClean</a></code></li><li><code class="directive"><a href="../mod/mod_disk_cache.html#cachegcmemusage">CacheGcMemUsage</a></code></li><li><code class="directive"><a href="../mod/mod_mem_cache.html#mcachesize">MCacheSize</a></code></li><li><code class="directive"><a href="../mod/mod_mem_cache.html#mcachemaxobjectcount">MCacheMaxObjectCount</a></code></li><li><code class="directive"><a href="../mod/mod_mem_cache.html#mcacheminobjectsize">MCacheMinObjectSize</a></code></li><li><code class="directive"><a href="../mod/mod_mem_cache.html#mcachemaxobjectsize">MCacheMaxObjectSize</a></code></li><li><code class="directive"><a href="../mod/mod_mem_cache.html#mcacheremovalalgorithm">MCacheRemovalAlgorithm</a></code></li></ul></td></tr></table>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2>Sample Configuration</h2>
<div class="example"><h3>Sample httpd.conf</h3><p><code>
# <br />
# Sample Cache Configuration <br />
# <br />
LoadModule cache_module modules/mod_cache.so <br />
&lt;IfModule mod_cache.c&gt; <br />
<br />
#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 />
<br />
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 />
<br />
&lt;/IfModule&gt; <br />
</code></p></div>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="CacheDefaultExpire" id="CacheDefaultExpire">CacheDefaultExpire</a> <a name="cachedefaultexpire" id="cachedefaultexpire">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td /></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>CacheDefaultExpire <em>seconds</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>CacheDefaultExpire 3600 (one hour)</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>Experimental</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td>mod_cache</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>
<div class="example"><p><code>
CacheDefaultExpire 86400
</code></p></div>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="CacheDisable" id="CacheDisable">CacheDisable</a> <a name="cachedisable" id="cachedisable">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Disable caching of specified URLs by specified storage manager</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>CacheDisable <em>cache_type </em> <em> url-string</em></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>Experimental</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td>mod_cache</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>
<div class="example"><h3>Example</h3><p><code>
CacheDisable disk /local_files
</code></p></div>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="CacheEnable" id="CacheEnable">CacheEnable</a> <a name="cacheenable" id="cacheenable">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Enable caching specified URLs in a specified storage manager</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>CacheEnable <em>cache_type </em><em> url-string</em></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>Experimental</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td>mod_cache</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>
<div class="example"><p><code>
CacheEnable disk / <br />
CacheEnable mem /manual <br />
CacheEnable fd /images <br />
</code></p></div>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="CacheForceCompletion" id="CacheForceCompletion">CacheForceCompletion</a> <a name="cacheforcecompletion" id="cacheforcecompletion">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Percentage of download to arrive for the cache to force complete transfer</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>CacheForceCompletion <em>Percentage</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>CacheForceCompletion 60</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>Experimental</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td>mod_cache</td></tr></table>
<p>Percentage of download to arrive for the cache to force complete transfert.</p>
<div class="example"><p><code>
CacheForceCompletion 80
</code></p></div>
<div class="warning">
This feature is currently <em>not</em> implemented.
</div>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="CacheIgnoreCacheControl" id="CacheIgnoreCacheControl">CacheIgnoreCacheControl</a> <a name="cacheignorecachecontrol" id="cacheignorecachecontrol">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Ignore requests from the client for uncached content</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>CacheIgnoreCacheControl</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>Experimental</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td>mod_cache</td></tr></table>
<p>Ignore requests from the client for uncached content</p>
<div class="example"><p><code>
CacheIgnoreNoLastMod
</code></p></div>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="CacheIgnoreNoLastMod" id="CacheIgnoreNoLastMod">CacheIgnoreNoLastMod</a> <a name="cacheignorenolastmod" id="cacheignorenolastmod">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Ignore responses where there is no Last Modified Header</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>CacheIgnoreNoLastMod</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>Experimental</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td>mod_cache</td></tr></table>
<p>Ignore responses where there is no Last Modified Header</p>
<div class="example"><p><code>
CacheIgnoreNoLastMod
</code></p></div>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="CacheLastModifiedFactor" id="CacheLastModifiedFactor">CacheLastModifiedFactor</a> <a name="cachelastmodifiedfactor" id="cachelastmodifiedfactor">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>The factor used to estimate the Expires date from the LastModified date</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>CacheLastModifiedFactor <em>float</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>CacheLastModifiedFactor 0.1</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>Experimental</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td>mod_cache</td></tr></table>
<p>The factor used to estimate the Expires date from the LastModified date.</p>
<div class="example"><p><code>
CacheLastModifiedFactor 0.5
</code></p></div>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="CacheMaxExpire" id="CacheMaxExpire">CacheMaxExpire</a> <a name="cachemaxexpire" id="cachemaxexpire">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>The maximum time in seconds to cache a document</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>CacheMaxExpire <em>seconds</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>CacheMaxExpire 86400 (one day)</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>Experimental</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td>mod_cache</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>
<div class="example"><p><code>
CacheMaxExpire 604800
</code></p></div>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="CacheMaxStreamingBuffer" id="CacheMaxStreamingBuffer">CacheMaxStreamingBuffer</a> <a name="cachemaxstreamingbuffer" id="cachemaxstreamingbuffer">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Maximum amount of a streamed response to buffer in memory before declaring the response uncacheable</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>CacheMaxStreamingBuffer <em>size_in_bytes</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>CacheMaxStreamingBuffer 0</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>Experimental</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td>mod_cache</td></tr></table>
<p>Maximum number of bytes of a streamed response (i.e., a response where
the entire content is not available all at once, such as a proxy or CGI
response) to buffer before deciding if the response is cacheable. By
default, a streamed response will <em>not</em> be cached unless it has a
Content-Length header. The reason for this is to avoid using a large amount
of memory to buffer a partial response that might end up being too large
to fit in the cache anyway. To enable caching of streamed responses, use
CacheMaxStreamingBuffer to specify the maximum amount of buffer space to use
per request.</p>
<p>Note: Using a nonzero value for CacheMaxStreamingBuffer will not delay the
transmission of the response to the client. As soon as mod_cache copies a
block of streamed content into a buffer, it sends the block on to the next
output filter for delivery to the client.</p>
<div class="example"><p><code>
# Enable caching of streamed responses up to 64KB:<br />
CacheMaxStreamingBuffer 65536
</code></p></div>
</div></div><div id="footer"><p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p><p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div></body></html>