2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
7 <description>Content cache keyed to URIs.</description>
8 <status>Experimental</status>
9 <sourcefile>mod_cache.c</sourcefile>
10 <identifier>cache_module</identifier>
14 This module is experimental. Documentation is still under development...
16 <p>mod_cache implements an RFC 2616 compliant HTTP content
17 cache that can be used to cache either local or proxied content.
18 mod_cache requires the services of one or more storage
19 management modules. Two storage management modules are included in
20 the base Apache distribution:</p>
22 <dt><em><module>mod_disk_cache</module></em></dt>
23 <dd>implements a disk based storage manager for use with <module>mod_proxy</module></dd>
24 <dt><em><module>mod_mem_cache</module></em></dt>
25 <dd>implements an in-memory based storage manager. mod_mem_cache
26 can be configured to operate in two modes: caching open file
27 descriptors or caching objects in heap storage. <em><module>mod_mem_cache</module></em>
28 is most useful when used to cache locally generated content or to cache
29 backend server content for mod_proxy configured for ProxyPass (aka <em>reverse proxy</em>)</dd>
31 <p>Content stored and retrived keyed to the URL. Content with
32 access protections is not cached.</p>
35 <section id="related"><title>Related Modules and Directives</title>
38 <module>mod_disk_cache</module>
39 <module>mod_mem_cache</module>
42 <directive module="mod_disk_cache">CacheRoot</directive>
43 <directive module="mod_disk_cache">CacheSize</directive>
44 <directive module="mod_disk_cache">CacheGcInterval</directive>
45 <directive module="mod_disk_cache">CacheDirLevels</directive>
46 <directive module="mod_disk_cache">CacheDirLength</directive>
47 <directive module="mod_disk_cache">CacheExpiryCheck</directive>
48 <directive module="mod_disk_cache">CacheMinFileSize</directive>
49 <directive module="mod_disk_cache">CacheMaxFileSize</directive>
50 <directive module="mod_disk_cache">CacheTimeMargin</directive>
51 <directive module="mod_disk_cache">CacheGcDaily</directive>
52 <directive module="mod_disk_cache">CacheGcUnused</directive>
53 <directive module="mod_disk_cache">CacheGcClean</directive>
54 <directive module="mod_disk_cache">CacheGcMemUsage</directive>
55 <directive module="mod_mem_cache">MCacheSize</directive>
56 <directive module="mod_mem_cache">MCacheMaxObjectCount</directive>
57 <directive module="mod_mem_cache">MCacheMinObjectSize</directive>
58 <directive module="mod_mem_cache">MCacheMaxObjectSize</directive>
59 <directive module="mod_mem_cache">MCacheRemovalAlgorithm</directive>
64 <section><title>Sample Configuration</title>
65 <example><title>Sample httpd.conf</title>
67 # Sample Cache Configuration <br />
69 LoadModule cache_module modules/mod_cache.so <br />
70 <IfModule mod_cache.c><br />
73 #LoadModule disk_cache_module modules/mod_disk_cache.so <br />
74 <IfModule mod_disk_cache.c> <br />
75 CacheRoot c:/cacheroot <br />
77 CacheEnable disk / <br />
78 CacheDirLevels 5 <br />
79 CacheDirLength 3 <br />
80 </IfModule> <br />
82 LoadModule mem_cache_module modules/mod_mem_cache.so <br />
83 <IfModule mod_mem_cache.c> <br />
84 MCacheEnable mem / <br />
85 MCacheSize 4096 <br />
86 MCacheMaxObjectCount 100 <br />
87 MCacheMinObjectSize 1 <br />
88 MCacheMaxObjectSize 2048 <br />
89 </IfModule> <br />
91 </IfModule> <br />
97 <description></description>
98 <syntax>CacheOn</syntax>
99 <contextlist><context>server config</context></contextlist>
113 <name>CacheEnable</name>
114 <description>Enable caching specified URLs in a specified storage manager</description>
115 <syntax>CacheEnable <em>cache_type </em><em> url-string</em></syntax>
116 <contextlist><context>server config</context></contextlist>
119 <p>The <directive>CacheEnable</directive> directive instructs
120 mod_cache to cache urls at or below <em>url-string</em>.
121 The cache store is specified with the <em>cache_type</em> argument.
122 <em>cache_type </em> <em> mem</em> instructs mod_cache to use the
123 in-memory cache storage manager implemented by <em>mod_mem_cache</em>.
124 <em>cache_type </em> <em> disk</em> instructs mod_cache to use the
125 cache storage manager implemented by <em>mod_disk_cache </em>. </p>
128 CacheEnable disk / <br />
129 CacheEnable mem /manual <br />
130 CacheEnable fd /images <br />
137 <name>CacheDisable</name>
138 <description>Disable caching of specified URLs by specified storage manager</description>
139 <syntax>CacheDisable <em>cache_type </em> <em> url-string</em></syntax>
140 <contextlist><context>server config</context></contextlist>
143 <p>The <directive>CacheDisable</directive> directive instructs
144 mod_cache to <em>not</em> cache urls at or above <em>url-string</em>.</p>
146 <example><title>Example</title>
147 CacheDisable disk /local_files
153 <name>CacheMaxExpire</name>
154 <description>The maximum time in seconds to cache a document</description>
155 <syntax>CacheMaxExpire <em>seconds</em></syntax>
156 <default>CacheMaxExpire 86400 (one day)</default>
157 <contextlist><context>server config</context></contextlist>
160 <p>The maximum time in seconds to cache a document. The <directive>CacheMaxExpire</directive>
161 takes precedence over the <em>Expire</em> field from the header.</p>
163 CacheMaxExpire 604800
168 <name>CacheDefaultExpire</name>
169 <syntax>CacheDefaultExpire <em>seconds</em></syntax>
170 <default>CacheDefaultExpire 3600 (one hour)</default>
171 <contextlist><context>server config</context></contextlist>
174 <p>The default time in seconds to cache a document if the page does not have
175 an expiry date in the <em>Expires</em> field.</p>
177 CacheDefaultExpire 86400
183 <name>CacheIgnoreNoLastMod</name>
184 <description>Ignore responses where there is no Last Modified Header</description>
185 <syntax>CacheIgnoreNoLastMod</syntax>
186 <contextlist><context>server config</context></contextlist>
189 <p>Ignore responses where there is no Last Modified Header</p>
198 <name>CacheIgnoreCacheControl</name>
199 <description>Ignore requests from the client for uncached content</description>
200 <syntax>CacheIgnoreCacheControl</syntax>
201 <contextlist><context>server config</context></contextlist>
204 <p>Ignore requests from the client for uncached content</p>
213 <name>CacheLastModifiedFactor</name>
214 <description>The factor used to estimate the Expires date from the LastModified date</description>
215 <syntax>CacheLastModifiedFactor <em>float</em></syntax>
216 <default>CacheLastModifiedFactor 0.1</default>
217 <contextlist><context>server config</context></contextlist>
220 <p>The factor used to estimate the Expires date from the LastModified date.</p>
223 CacheLastModifiedFactor
229 <name>CacheForceCompletion</name>
230 <description>Percentage of download to arrive for the cache to force complete transfert</description>
231 <syntax>CacheLastModifiedFactor <em>Percentage</em></syntax>
232 <default>CacheLastModifiedFactor 60</default>
233 <contextlist><context>server config</context></contextlist>
236 <p>Percentage of download to arrive for the cache to force complete transfert.</p>
241 <note type="warning">
242 This feature is currently <em>not</em> implemented.
248 <name>CacheForceCompletion</name>
249 <description>Percentage of download to arrive for the cache to force complete transfert</description>
250 <syntax>CacheLastModifiedFactor <em>Percentage</em></syntax>
251 <default>CacheLastModifiedFactor 60</default>
252 <contextlist><context>server config</context></contextlist>
255 <p>Percentage of download to arrive for the cache to force complete transfert.</p>
260 <note type="warning">
261 This feature is currently <em>not</em> implemented.