summaryrefslogtreecommitdiffstats
path: root/docs/manual/mod/mod_cache.xml
blob: 2a920cb3e7d2020c9d7267dd4ad972a3597682ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
<modulesynopsis>

<name>mod_cache</name>
<description>Content cache keyed to URIs.</description>
<status>Experimental</status>
<sourcefile>mod_cache.c</sourcefile>
<identifier>cache_module</identifier>

<summary>
    <note type="warning">
    This module is experimental. Documentation is still under development...
    </note>
    <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><module>mod_disk_cache</module></em></dt>
    <dd>implements a disk based storage manager for use with <module>mod_proxy</module></dd>
    <dt><em><module>mod_mem_cache</module></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><module>mod_mem_cache</module></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>
</summary>

<section id="related"><title>Related Modules and Directives</title>
    <related>
      <modulelist>
        <module>mod_disk_cache</module>
        <module>mod_mem_cache</module>
      </modulelist>
      <directivelist>
        <directive module="mod_disk_cache">CacheRoot</directive>
        <directive module="mod_disk_cache">CacheSize</directive>
        <directive module="mod_disk_cache">CacheGcInterval</directive>
        <directive module="mod_disk_cache">CacheDirLevels</directive>
        <directive module="mod_disk_cache">CacheDirLength</directive>
        <directive module="mod_disk_cache">CacheExpiryCheck</directive>
        <directive module="mod_disk_cache">CacheMinFileSize</directive>
        <directive module="mod_disk_cache">CacheMaxFileSize</directive>
        <directive module="mod_disk_cache">CacheTimeMargin</directive>
        <directive module="mod_disk_cache">CacheGcDaily</directive>
        <directive module="mod_disk_cache">CacheGcUnused</directive>
        <directive module="mod_disk_cache">CacheGcClean</directive>
        <directive module="mod_disk_cache">CacheGcMemUsage</directive>
        <directive module="mod_mem_cache">MCacheSize</directive>
        <directive module="mod_mem_cache">MCacheMaxObjectCount</directive>
        <directive module="mod_mem_cache">MCacheMinObjectSize</directive>
        <directive module="mod_mem_cache">MCacheMaxObjectSize</directive>
        <directive module="mod_mem_cache">MCacheRemovalAlgorithm</directive>
      </directivelist>
    </related>
</section>

<section><title>Sample Configuration</title>
<example><title>Sample httpd.conf</title>
# <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 />
<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 />
&lt;/IfModule&gt; <br />
</example>
</section>

<directivesynopsis>
<name>CacheEnable</name>
<description>Enable caching specified URLs in a specified storage manager</description>
<syntax>CacheEnable <em>cache_type </em><em> url-string</em></syntax>
<contextlist><context>server config</context></contextlist>

<usage>
    <p>The <directive>CacheEnable</directive> 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>

<example>
  CacheEnable  disk  / <br />
  CacheEnable  mem   /manual <br />
  CacheEnable  fd    /images <br />
</example>
</usage>

</directivesynopsis>

<directivesynopsis>
<name>CacheDisable</name>
<description>Disable caching of specified URLs by specified storage manager</description>
<syntax>CacheDisable <em>cache_type </em> <em> url-string</em></syntax>
<contextlist><context>server config</context></contextlist>

<usage>
    <p>The <directive>CacheDisable</directive> directive instructs
    mod_cache to <em>not</em> cache urls at or above <em>url-string</em>.</p>

<example><title>Example</title>
  CacheDisable disk /local_files
</example>
</usage>

</directivesynopsis>
<directivesynopsis>
<name>CacheMaxExpire</name>
<description>The maximum time in seconds to cache a document</description>
<syntax>CacheMaxExpire <em>seconds</em></syntax>
<default>CacheMaxExpire 86400 (one day)</default>
<contextlist><context>server config</context></contextlist>

<usage>
    <p>The maximum time in seconds to cache a document. The <directive>CacheMaxExpire</directive>
    takes precedence over the <em>Expire</em> field from the header.</p>
    <example>
    CacheMaxExpire 604800
    </example>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>CacheDefaultExpire</name>
<syntax>CacheDefaultExpire <em>seconds</em></syntax>
<default>CacheDefaultExpire 3600 (one hour)</default>
<contextlist><context>server config</context></contextlist>

<usage>
    <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>
    <example>
    CacheDefaultExpire 86400
    </example>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>CacheIgnoreNoLastMod</name>
<description>Ignore responses where there is no Last Modified Header</description>
<syntax>CacheIgnoreNoLastMod</syntax>
<contextlist><context>server config</context></contextlist>

<usage>
    <p>Ignore responses where there is no Last Modified Header</p>

    <example>
    CacheIgnoreNoLastMod 
    </example>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>CacheIgnoreCacheControl</name>
<description>Ignore requests from the client for uncached content</description>
<syntax>CacheIgnoreCacheControl</syntax>
<contextlist><context>server config</context></contextlist>

<usage>
    <p>Ignore requests from the client for uncached content</p>

    <example>
    CacheIgnoreNoLastMod 
    </example>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>CacheLastModifiedFactor</name>
<description>The factor used to estimate the Expires date from the LastModified date</description>
<syntax>CacheLastModifiedFactor <em>float</em></syntax>
<default>CacheLastModifiedFactor 0.1</default>
<contextlist><context>server config</context></contextlist>

<usage>
    <p>The factor used to estimate the Expires date from the LastModified date.</p>

    <example>
    CacheLastModifiedFactor  
    </example>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>CacheForceCompletion</name>
<description>Percentage of download to arrive for the cache to force complete transfert</description>
<syntax>CacheLastModifiedFactor <em>Percentage</em></syntax>
<default>CacheLastModifiedFactor 60</default>
<contextlist><context>server config</context></contextlist>

<usage>
    <p>Percentage of download to arrive for the cache to force complete transfert.</p>

    <example>
    CacheForceCompletion  
    </example>
<note type="warning">
This feature is currently <em>not</em> implemented.
</note>
 </usage>
 </directivesynopsis>

<directivesynopsis>
<name>CacheForceCompletion</name>
<description>Percentage of download to arrive for the cache to force complete transfer</description>
<syntax>CacheLastModifiedFactor <em>Percentage</em></syntax>
<default>CacheLastModifiedFactor 60</default>
<contextlist><context>server config</context></contextlist>

<usage>
    <p>Percentage of download to arrive for the cache to force complete transfer.</p>

    <example>
    CacheForceCompletion  
    </example>
<note type="warning">
This feature is currently <em>not</em> implemented.
</note>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>CacheMaxStreamingBuffer</name>
<description>Maximum amount of a streamed response to buffer in memory before declaring the response uncacheable</description>
<syntax>CacheMaxStreamingBuffer <em>size_in_bytes</em></syntax>
<default>CacheMaxStreamingBuffer 0</default>
<contextlist><context>server config</context></contextlist>

<usage>
    <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>

    <example>
    # Enable caching of streamed responses up to 64KB:
    CacheMaxStreamingBuffer  65536
    </example>
</usage>
</directivesynopsis>

</modulesynopsis>