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>
15 This module is experimental. Documentation is still under development...
17 <p>mod_cache implements an RFC 2616 compliant HTTP content
18 cache that can be used to cache either local or proxied content.
19 mod_cache requires the services of one or more storage
20 management modules. Two storage management modules are included in
21 the base Apache distribution:</p>
23 <dt><em><module>mod_disk_cache</module></em></dt>
24 <dd>implements a disk based storage manager for use with <module>mod_proxy</module></dd>
25 <dt><em><module>mod_mem_cache</module></em></dt>
26 <dd>implements an in-memory based storage manager. mod_mem_cache
27 can be configured to operate in two modes: caching open file
28 descriptors or caching objects in heap storage. <em><module>mod_mem_cache</module></em>
29 is most useful when used to cache locally generated content or to cache
30 backend server content for mod_proxy configured for ProxyPass (aka <em>reverse proxy</em>)</dd>
32 <p>Content stored and retrived keyed to the URL. Content with
33 access protections is not cached.</p>
37 <module>mod_disk_cache</module>
38 <module>mod_mem_cache</module>
41 <directive module="mod_disk_cache">CacheRoot</directive>
42 <directive module="mod_disk_cache">CacheSize</directive>
43 <directive module="mod_disk_cache">CacheGcInterval</directive>
44 <directive module="mod_disk_cache">CacheDirLevels</directive>
45 <directive module="mod_disk_cache">CacheDirLength</directive>
46 <directive module="mod_disk_cache">CacheExpiryCheck</directive>
47 <directive module="mod_disk_cache">CacheMinFileSize</directive>
48 <directive module="mod_disk_cache">CacheMaxFileSize</directive>
49 <directive module="mod_disk_cache">CacheTimeMargin</directive>
50 <directive module="mod_disk_cache">CacheGcDaily</directive>
51 <directive module="mod_disk_cache">CacheGcUnused</directive>
52 <directive module="mod_disk_cache">CacheGcClean</directive>
53 <directive module="mod_disk_cache">CacheGcMemUsage</directive>
54 <directive module="mod_mem_cache">MCacheSize</directive>
55 <directive module="mod_mem_cache">MCacheMaxObjectCount</directive>
56 <directive module="mod_mem_cache">MCacheMinObjectSize</directive>
57 <directive module="mod_mem_cache">MCacheMaxObjectSize</directive>
58 <directive module="mod_mem_cache">MCacheRemovalAlgorithm</directive>
63 <section><title>Sample Configuration</title>
65 <example><title>Sample httpd.conf</title>
68 # Sample Cache Configuration <br />
70 LoadModule cache_module modules/mod_cache.so <br />
71 <IfModule mod_cache.c><br />
74 #LoadModule disk_cache_module modules/mod_disk_cache.so <br />
75 <IfModule mod_disk_cache.c> <br />
76 CacheRoot c:/cacheroot <br />
78 CacheEnable disk / <br />
79 CacheDirLevels 5 <br />
80 CacheDirLength 3 <br />
81 </IfModule> <br />
83 LoadModule mem_cache_module modules/mod_mem_cache.so <br />
84 <IfModule mod_mem_cache.c> <br />
85 MCacheEnable mem / <br />
86 MCacheSize 4096 <br />
87 MCacheMaxObjectCount 100 <br />
88 MCacheMinObjectSize 1 <br />
89 MCacheMaxObjectSize 2048 <br />
90 </IfModule> <br />
92 </IfModule> <br />
100 <description></description>
101 <syntax>CacheOn</syntax>
102 <contextlist><context>server config</context></contextlist>
116 <name>CacheEnable</name>
117 <description>Enable caching specified URLs in a specified storage manager</description>
118 <syntax>CacheEnable <em>cache_type </em><em> url-string</em></syntax>
119 <contextlist><context>server config</context></contextlist>
122 <p>The <directive>CacheEnable</directive> directive instructs
123 mod_cache to cache urls at or below <em>url-string</em>.
124 The cache store is specified with the <em>cache_type</em> argument.
125 <em>cache_type </em> <em> mem</em> instructs mod_cache to use the
126 in-memory cache storage manager implemented by <em>mod_mem_cache</em>.
127 <em>cache_type </em> <em> disk</em> instructs mod_cache to use the
128 cache storage manager implemented by <em>mod_disk_cache </em>. </p>
131 CacheEnable disk / <br />
132 CacheEnable mem /manual <br />
133 CacheEnable fd /images <br />
140 <name>CacheDisable</name>
141 <description>Disable caching of specified URLs by specified storage manager</description>
142 <syntax>CacheDisable <em>cache_type </em> <em> url-string</em></syntax>
143 <contextlist><context>server config</context></contextlist>
146 <p>The <directive>CacheDisable</directive> directive instructs
147 mod_cache to <em>not</em> cache urls at or above <em>url-string</em>.</p>
149 <example><title>Example</title>
150 CacheDisable disk /local_files
156 <name>CacheMaxExpire</name>
157 <description>The maximum time in seconds to cache a document</description>
158 <syntax>CacheMaxExpire <em>seconds</em></syntax>
159 <default>CacheMaxExpire 86400 <em>(one day)</em></default>
160 <contextlist><context>server config</context></contextlist>
163 <p>The maximum time in seconds to cache a document. The <directive>CacheMaxExpire</directive>
164 takes precedence over the <em>Expire</em> field from the header.</p>
166 CacheMaxExpire 604800
171 <name>CacheDefaultExpire</name>
172 <syntax>CacheDefaultExpire <em>seconds</em></syntax>
173 <default>CacheDefaultExpire 3600 <em>(one hour)</em></default>
174 <contextlist><context>server config</context></contextlist>
177 <p>The default time in seconds to cache a document if the page does not have
178 an expiry date in the <em>Expires</em> field.</p>
180 CacheDefaultExpire 86400
186 <name>CacheIgnoreNoLastMod</name>
187 <description>Ignore responses where there is no Last Modified Header</description>
188 <syntax>CacheIgnoreNoLastMod</syntax>
189 <contextlist><context>server config</context></contextlist>
192 <p>Ignore responses where there is no Last Modified Header</p>
201 <name>CacheIgnoreCacheControl</name>
202 <description>Ignore requests from the client for uncached content</description>
203 <syntax>CacheIgnoreCacheControl</syntax>
204 <contextlist><context>server config</context></contextlist>
207 <p>Ignore requests from the client for uncached content</p>
216 <name>CacheLastModifiedFactor</name>
217 <description>The factor used to estimate the Expires date from the LastModified date</description>
218 <syntax>CacheLastModifiedFactor <em>float</em></syntax>
219 <default>CacheLastModifiedFactor 0.1</default>
220 <contextlist><context>server config</context></contextlist>
223 <p>The factor used to estimate the Expires date from the LastModified date.</p>
226 CacheLastModifiedFactor
232 <name>CacheForceCompletion</name>
233 <description>Percentage of download to arrive for the cache to force complete transfert</description>
234 <syntax>CacheLastModifiedFactor <em>Percentage</em></syntax>
235 <default>CacheLastModifiedFactor 60</default>
236 <contextlist><context>server config</context></contextlist>
239 <p>Percentage of download to arrive for the cache to force complete transfert.</p>
244 <note type="warning">
245 This feature is currently <em>not</em> implemented.
251 <name>CacheForceCompletion</name>
252 <description>Percentage of download to arrive for the cache to force complete transfert</description>
253 <syntax>CacheLastModifiedFactor <em>Percentage</em></syntax>
254 <default>CacheLastModifiedFactor 60</default>
255 <contextlist><context>server config</context></contextlist>
258 <p>Percentage of download to arrive for the cache to force complete transfert.</p>
263 <note type="warning">
264 This feature is currently <em>not</em> implemented.