]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_cache.xml
mod_cache: Teach CacheEnable and CacheDisable to work from within a
[apache] / docs / manual / mod / mod_cache.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
5
6 <!--
7  Licensed to the Apache Software Foundation (ASF) under one or more
8  contributor license agreements.  See the NOTICE file distributed with
9  this work for additional information regarding copyright ownership.
10  The ASF licenses this file to You under the Apache License, Version 2.0
11  (the "License"); you may not use this file except in compliance with
12  the License.  You may obtain a copy of the License at
13
14      http://www.apache.org/licenses/LICENSE-2.0
15
16  Unless required by applicable law or agreed to in writing, software
17  distributed under the License is distributed on an "AS IS" BASIS,
18  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  See the License for the specific language governing permissions and
20  limitations under the License.
21 -->
22
23 <modulesynopsis metafile="mod_cache.xml.meta">
24
25 <name>mod_cache</name>
26 <description>Content cache keyed to URIs.</description>
27 <status>Extension</status>
28 <sourcefile>mod_cache.c</sourcefile>
29 <identifier>cache_module</identifier>
30
31 <summary>
32     <note type="warning">This module should be used with care, as when the
33     <directive module="mod_cache">CacheQuickHandler</directive> directive is
34     in its default value of <strong>on</strong>, the <directive 
35     module="mod_authz_host">Allow</directive> and <directive 
36     module="mod_authz_host">Deny</directive> directives will be circumvented.
37     You should not enable quick handler caching for any content to which you
38     wish to limit access by client host name, address or environment
39     variable.</note>  
40
41     <p><module>mod_cache</module> implements an <a
42     href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a> compliant HTTP
43     content cache that can be used to cache either local or proxied content.
44     <module>mod_cache</module> requires the services of one or more storage
45     management modules. One storage management module is included in
46     the base Apache distribution:</p>
47     <dl>
48     <dt><module>mod_disk_cache</module></dt>
49     <dd>implements a disk based storage manager.</dd>
50     </dl>
51
52     <p>Content is stored in and retrieved from the cache using URI based keys. Content with
53     access protection is not cached.</p>
54     <p>Further details, discussion, and examples, are provided in the
55     <a href="../caching.html">Caching Guide</a>.</p>
56 </summary>
57 <seealso><a href="../caching.html">Caching Guide</a></seealso>
58
59 <section id="related"><title>Related Modules and Directives</title>
60     <related>
61       <modulelist>
62         <module>mod_disk_cache</module>
63       </modulelist>
64       <directivelist>
65         <directive module="mod_disk_cache">CacheRoot</directive>
66         <directive module="mod_disk_cache">CacheDirLevels</directive>
67         <directive module="mod_disk_cache">CacheDirLength</directive>
68         <directive module="mod_disk_cache">CacheMinFileSize</directive>
69         <directive module="mod_disk_cache">CacheMaxFileSize</directive>
70       </directivelist>
71     </related>
72 </section>
73
74 <section id="sampleconf"><title>Sample Configuration</title>
75     <example><title>Sample httpd.conf</title>
76       #<br />
77       # Sample Cache Configuration<br />
78       #<br />
79       LoadModule cache_module modules/mod_cache.so<br />
80       <br />
81       &lt;IfModule mod_cache.c&gt;<br />
82       <indent>
83         LoadModule disk_cache_module modules/mod_disk_cache.so<br />
84         &lt;IfModule mod_disk_cache.c&gt;<br />
85         <indent>
86           CacheRoot c:/cacheroot<br />
87           CacheEnable disk  /<br />
88           CacheDirLevels 5<br />
89           CacheDirLength 3<br />
90         </indent>
91         &lt;/IfModule&gt; <br />
92         <br />
93         # When acting as a proxy, don't cache the list of security updates<br />
94         CacheDisable http://security.update.server/update-list/<br />
95       </indent>
96       &lt;/IfModule&gt;
97     </example>
98 </section>
99
100 <section id="thunderingherd"><title>Avoiding the Thundering Herd</title>
101   <p>When a cached entry becomes stale, <module>mod_cache</module> will submit
102   a conditional request to the backend, which is expected to confirm whether the
103   cached entry is still fresh, and send an updated entity if not.</p>
104   <p>A small but finite amount of time exists between the time the cached entity
105   becomes stale, and the time the stale entity is fully refreshed. On a busy
106   server, a significant number of requests might arrive during this time, and
107   cause a <strong>thundering herd</strong> of requests to strike the backend
108   suddenly and unpredicably.</p>
109   <p>To keep the thundering herd at bay, the <directive>CacheLock</directive>
110   directive can be used to define a directory in which locks are created for
111   URLs <strong>in flight</strong>. The lock is used as a <strong>hint</strong>
112   by other requests to either suppress an attempt to cache (someone else has
113   gone to fetch the entity), or to indicate that a stale entry is being refreshed
114   (stale content will be returned in the mean time).
115   </p>
116   <section>
117     <title>Initial caching of an entry</title>
118     <p>When an entity is cached for the first time, a lock will be created for the
119     entity until the response has been fully cached. During the lifetime of the
120     lock, the cache will suppress the second and subsequent attempt to cache the
121     same entity. While this doesn't hold back the thundering herd, it does stop
122     the cache attempting to cache the same entity multiple times simultaneously.
123     </p>
124   </section>
125   <section>
126     <title>Refreshment of a stale entry</title>
127     <p>When an entity reaches its freshness lifetime and becomes stale, a lock
128     will be created for the entity until the response has either been confirmed as
129     still fresh, or replaced by the backend. During the lifetime of the lock, the
130     second and subsequent incoming request will cause stale data to be returned,
131     and the thundering herd is kept at bay.</p>
132   </section>
133   <section>
134     <title>Locks and Cache-Control: no-cache</title>
135     <p>Locks are used as a <strong>hint only</strong> to enable the cache to be
136     more gentle on backend servers, however the lock can be overridden if necessary.
137     If the client sends a request with a Cache-Control header forcing a reload, any
138     lock that may be present will be ignored, and the client's request will be
139     honoured immediately and the cached entry refreshed.</p>
140     <p>As a further safety mechanism, locks have a configurable maximum age.
141     Once this age has been reached, the lock is removed, and a new request is
142     given the opportunity to create a new lock. This maximum age can be set using
143     the <directive>CacheLockMaxAge</directive> directive, and defaults to 5
144     seconds.
145     </p>
146   </section>
147   <section>
148     <title>Example configuration</title>
149     <example><title>Enabling the cache lock</title>
150       #<br />
151       # Enable the cache lock<br />
152       #<br />
153       &lt;IfModule mod_cache.c&gt;<br />
154       <indent>
155         CacheLock on<br />
156         CacheLockPath /tmp/mod_cache-lock<br />
157         CacheLockMaxAge 5<br />
158       </indent>
159       &lt;/IfModule&gt;
160     </example>
161   </section>
162 </section>
163
164 <section id="finecontrol"><title>Fine Control with the CACHE Filter</title>
165   <p>Under the default mode of cache operation, the cache runs as a quick handler,
166   short circuiting the majority of server processing and offering the highest
167   cache performance available.</p>
168   
169   <p>In this mode, the cache <strong>bolts onto</strong> the front of the server,
170   acting as if a free standing RFC2616 caching proxy had been placed in front of
171   the server.</p>
172   
173   <p>While this mode offers the best performance, the administrator may find that
174   under certain circumstances they may want to perform further processing on the
175   request after the request is cached, such as to inject personalisation into the
176   cached page, or to apply authorisation restrictions to the content. Under these
177   circumstances, an administrator is often forced to place independent reverse
178   proxy servers either behind or in front of the caching server to achieve this.</p>
179
180   <p>To solve this problem the <directive module="mod_cache">CacheQuickHandler
181   </directive> directive can be set to <strong>off</strong>, and the server will
182   process all phases normally handled by a non cached request, including the
183   <strong>authentication and authorisation</strong> phases.</p>
184
185   <p>In addition, the administrator may optionally specify the <strong>precise point
186   within the filter chain</strong> where caching is to take place by adding the
187   <strong>CACHE</strong> filter to the output filter chain.</p>
188
189   <p>For example, to cache content before applying compression to the response,
190   place the <strong>CACHE</strong> filter before the <strong>DEFLATE</strong>
191   filter as in the example below:</p>
192
193   <example>
194     # Cache content before optional compression<br />
195     CacheQuickHandler off<br />
196     AddOutputFilterByType CACHE;DEFLATE text/plain<br /><br />
197   </example>
198
199   <p>Another option is to have content cached before personalisation is applied
200   by <module>mod_include</module> (or another content processing filter). In this
201   example templates containing tags understood by
202   <module>mod_include</module> are cached before being parsed:</p>
203
204   <example>
205     # Cache content before mod_include and mod_deflate<br />
206     CacheQuickHandler off<br />
207     AddOutputFilterByType CACHE;INCLUDES;DEFLATE text/html<br /><br />
208   </example>
209
210   <p>You may place the <strong>CACHE</strong> filter anywhere you wish within the
211   filter chain. In this example, content is cached after being parsed by
212   <module>mod_include</module>, but before being processed by
213   <module>mod_deflate</module>:</p>
214
215   <example>
216     # Cache content between mod_include and mod_deflate<br />
217     CacheQuickHandler off<br />
218     AddOutputFilterByType INCLUDES;CACHE;DEFLATE text/html<br /><br />
219   </example>
220
221   <note type="warning"><title>Warning:</title>If the location of the
222   <strong>CACHE</strong> filter in the filter chain is changed for any reason,
223   you may need to <strong>flush your cache</strong> to ensure that your data
224   served remains consistent. <module>mod_cache</module> is not in a position
225   to enforce this for you.</note>
226
227 </section>
228
229 <directivesynopsis>
230 <name>CacheEnable</name>
231 <description>Enable caching of specified URLs using a specified storage
232 manager</description>
233 <syntax>CacheEnable <var>cache_type</var> <var>url-string</var></syntax>
234 <contextlist><context>server config</context><context>virtual host</context>
235 </contextlist>
236
237 <usage>
238     <p>The <directive>CacheEnable</directive> directive instructs
239     <module>mod_cache</module> to cache urls at or below
240     <var>url-string</var>. The cache storage manager is specified with the
241     <var>cache_type</var> argument. If the <directive>CacheEnable</directive>
242     directive is placed inside a <directive type="section">Location</directive>
243     directive, the <var>url-string</var> becomes optional.
244     <var>cache_type</var> <code>disk</code> instructs
245     <module>mod_cache</module> to use the disk based storage manager
246     implemented by <module>mod_disk_cache</module>.</p>
247     <p>In the event that the URL space overlaps between different
248     <directive>CacheEnable</directive> directives (as in the example below),
249     each possible storage manager will be run until the first one that
250     actually processes the request. The order in which the storage managers are
251     run is determined by the order of the <directive>CacheEnable</directive>
252     directives in the configuration file.</p>
253
254     <p>When acting as a forward proxy server, <var>url-string</var> can
255     also be used to specify remote sites and proxy protocols which 
256     caching should be enabled for.</p>
257  
258     <example>
259       # Cache proxied url's<br />
260       CacheEnable  disk  /<br /><br />
261       # Cache FTP-proxied url's<br />
262       CacheEnable  disk  ftp://<br /><br />
263       # Cache content from www.apache.org<br />
264       CacheEnable  disk  http://www.apache.org/<br />
265     </example>
266
267     <p>A hostname starting with a <strong>"*"</strong> matches all hostnames with
268     that suffix. A hostname starting with <strong>"."</strong> matches all
269     hostnames containing the domain components that follow.</p>
270
271     <example>
272       # Match www.apache.org, and fooapache.org<br />
273       CacheEnable  disk  http://*apache.org/<br />
274       # Match www.apache.org, but not fooapache.org<br />
275       CacheEnable  disk  http://.apache.org/<br />
276     </example>
277
278     <p> The <code>no-cache</code> environment variable can be set to 
279     disable caching on a finer grained set of resources in versions
280     2.2.12 and later.</p>
281
282 </usage>
283 <seealso><a href="../env.html">Environment Variables in Apache</a></seealso>
284 </directivesynopsis>
285
286 <directivesynopsis>
287 <name>CacheDisable</name>
288 <description>Disable caching of specified URLs</description>
289 <syntax>CacheDisable <var>url-string</var> | <var>on</var></syntax>
290 <contextlist><context>server config</context><context>virtual host</context>
291 </contextlist>
292
293 <usage>
294     <p>The <directive>CacheDisable</directive> directive instructs
295     <module>mod_cache</module> to <em>not</em> cache urls at or below
296     <var>url-string</var>.</p>
297
298     <example><title>Example</title>
299       CacheDisable /local_files
300     </example>
301
302     <p>If used in a <directive type="section">Location</directive> directive,
303     the path needs to be specified below the Location, or if the word "on"
304     is used, caching for the whole location will be disabled.</p>
305
306     <example><title>Example</title>
307       &lt;Location /foo&gt;<br />
308         CacheDisable on<br />
309       &lt;/Location&gt;<br />
310     </example>
311
312     <p> The <code>no-cache</code> environment variable can be set to 
313     disable caching on a finer grained set of resources in versions
314     2.2.12 and later.</p>
315
316 </usage>
317 <seealso><a href="../env.html">Environment Variables in Apache</a></seealso>
318 </directivesynopsis>
319 <directivesynopsis>
320 <name>CacheMaxExpire</name>
321 <description>The maximum time in seconds to cache a document</description>
322 <syntax>CacheMaxExpire <var>seconds</var></syntax>
323 <default>CacheMaxExpire 86400 (one day)</default>
324 <contextlist><context>server config</context><context>virtual host</context>
325 </contextlist>
326
327 <usage>
328     <p>The <directive>CacheMaxExpire</directive> directive specifies the maximum number of
329     seconds for which cachable HTTP documents will be retained without checking the origin
330     server. Thus, documents will be out of date at most this number of seconds. This maximum
331     value is enforced even if an expiry date was supplied with the document.</p>
332
333     <example>
334       CacheMaxExpire 604800
335     </example>
336 </usage>
337 </directivesynopsis>
338
339 <directivesynopsis>
340 <name>CacheMinExpire</name>
341 <description>The minimum time in seconds to cache a document</description>
342 <syntax>CacheMinExpire <var>seconds</var></syntax>
343 <default>CacheMinExpire 0</default>
344 <contextlist><context>server config</context><context>virtual host</context>
345 </contextlist>
346
347 <usage>
348     <p>The <directive>CacheMinExpire</directive> directive specifies the minimum number of
349     seconds for which cachable HTTP documents will be retained without checking the origin
350     server. This is only used if no valid expire time was supplied with the document.</p>
351
352
353     <example>
354       CacheMinExpire 3600
355     </example>
356 </usage>
357 </directivesynopsis>
358
359 <directivesynopsis>
360 <name>CacheDefaultExpire</name>
361 <description>The default duration to cache a document when no expiry date is specified.</description>
362 <syntax>CacheDefaultExpire <var>seconds</var></syntax>
363 <default>CacheDefaultExpire 3600 (one hour)</default>
364 <contextlist><context>server config</context><context>virtual host</context>
365 </contextlist>
366
367 <usage>
368     <p>The <directive>CacheDefaultExpire</directive> directive specifies a default time,
369     in seconds, to cache a document if neither an expiry date nor last-modified date are provided
370     with the document. The value specified with the <directive>CacheMaxExpire</directive>
371     directive does <em>not</em> override this setting.</p>
372
373     <example>
374       CacheDefaultExpire 86400
375     </example>
376 </usage>
377 </directivesynopsis>
378
379 <directivesynopsis>
380 <name>CacheIgnoreNoLastMod</name>
381 <description>Ignore the fact that a response has no Last Modified
382 header.</description>
383 <syntax>CacheIgnoreNoLastMod On|Off</syntax>
384 <default>CacheIgnoreNoLastMod Off</default>
385 <contextlist><context>server config</context><context>virtual host</context>
386 </contextlist>
387
388 <usage>
389     <p>Ordinarily, documents without a last-modified date are not cached.
390     Under some circumstances the last-modified date is removed (during
391     <module>mod_include</module> processing for example) or not provided
392     at all. The <directive>CacheIgnoreNoLastMod</directive> directive
393     provides a way to specify that documents without last-modified dates
394     should be considered for caching, even without a last-modified date.
395     If neither a last-modified date nor an expiry date are provided with
396     the document then the value specified by the
397     <directive>CacheDefaultExpire</directive> directive will be used to
398     generate an expiration date.</p>
399
400     <example>
401       CacheIgnoreNoLastMod On
402     </example>
403 </usage>
404 </directivesynopsis>
405
406 <directivesynopsis>
407 <name>CacheIgnoreCacheControl</name>
408 <description>Ignore request to not serve cached content to client</description>
409 <syntax>CacheIgnoreCacheControl On|Off</syntax>
410 <default>CacheIgnoreCacheControl Off</default>
411 <contextlist><context>server config</context><context>virtual host</context>
412 </contextlist>
413
414 <usage>
415     <p>Ordinarily, requests containing a Cache-Control: no-cache or
416     Pragma: no-cache header value will not be served from the cache.  The
417     <directive>CacheIgnoreCacheControl</directive> directive allows this
418     behavior to be overridden.  <directive>CacheIgnoreCacheControl On</directive>
419     tells the server to attempt to serve the resource from the cache even
420     if the request contains no-cache header values.  Resources requiring
421     authorization will <em>never</em> be cached.</p>
422
423     <example>
424       CacheIgnoreCacheControl On
425     </example>
426
427     <note type="warning"><title>Warning:</title>
428        This directive will allow serving from the cache even if the client has
429        requested that the document not be served from the cache.  This might
430        result in stale content being served.
431     </note>
432 </usage>
433 <seealso><directive module="mod_cache">CacheStorePrivate</directive></seealso>
434 <seealso><directive module="mod_cache">CacheStoreNoStore</directive></seealso>
435 </directivesynopsis>
436
437 <directivesynopsis>
438 <name>CacheIgnoreQueryString</name>
439 <description>Ignore query string when caching</description>
440 <syntax>CacheIgnoreQueryString On|Off</syntax>
441 <default>CacheIgnoreQueryString Off</default>
442 <contextlist><context>server config</context><context>virtual host</context>
443 </contextlist>
444
445 <usage>
446     <p>Ordinarily, requests with query string parameters are cached separately
447     for each unique query string. This is according to RFC 2616/13.9 done only
448     if an expiration time is specified. The 
449     <directive>CacheIgnoreQueryString</directive> directive tells the cache to
450     cache requests even if no expiration time is specified, and to reply with 
451     a cached reply even if the query string differs. From a caching point of
452     view the request is treated as if having no query string when this 
453     directive is enabled.</p>
454
455     <example>
456       CacheIgnoreQueryString On
457     </example>
458
459 </usage>
460 </directivesynopsis>
461
462 <directivesynopsis>
463 <name>CacheLastModifiedFactor</name>
464 <description>The factor used to compute an expiry date based on the
465 LastModified date.</description>
466 <syntax>CacheLastModifiedFactor <var>float</var></syntax>
467 <default>CacheLastModifiedFactor 0.1</default>
468 <contextlist><context>server config</context><context>virtual host</context>
469 </contextlist>
470
471 <usage>
472     <p>In the event that a document does not provide an expiry date but does
473     provide a last-modified date, an expiry date can be calculated based on
474     the time since the document was last modified. The
475     <directive>CacheLastModifiedFactor</directive> directive specifies a
476     <var>factor</var> to be used in the generation of this expiry date
477     according to the following formula:
478
479     <code>expiry-period = time-since-last-modified-date * <var>factor</var>
480     expiry-date = current-date + expiry-period</code>
481
482     For example, if the document was last modified 10 hours ago, and
483     <var>factor</var> is 0.1 then the expiry-period will be set to
484     10*0.1 = 1 hour. If the current time was 3:00pm then the computed
485     expiry-date would be 3:00pm + 1hour = 4:00pm.
486
487     If the expiry-period would be longer than that set by
488     <directive>CacheMaxExpire</directive>, then the latter takes
489     precedence.</p>
490
491     <example>
492       CacheLastModifiedFactor 0.5
493     </example>
494 </usage>
495 </directivesynopsis>
496
497 <directivesynopsis>
498 <name>CacheIgnoreHeaders</name>
499 <description>Do not store the given HTTP header(s) in the cache.
500 </description>
501 <syntax>CacheIgnoreHeaders <var>header-string</var> [<var>header-string</var>] ...</syntax>
502 <default>CacheIgnoreHeaders None</default>
503 <contextlist><context>server config</context><context>virtual host</context>
504 </contextlist>
505
506 <usage>
507     <p>According to RFC 2616, hop-by-hop HTTP headers are not stored in
508     the cache.  The following HTTP headers are hop-by-hop headers and thus
509     do not get stored in the cache in <em>any</em> case regardless of the
510     setting of <directive>CacheIgnoreHeaders</directive>:</p>
511
512     <ul>
513       <li><code>Connection</code></li>
514       <li><code>Keep-Alive</code></li>
515       <li><code>Proxy-Authenticate</code></li>
516       <li><code>Proxy-Authorization</code></li>
517       <li><code>TE</code></li>
518       <li><code>Trailers</code></li>
519       <li><code>Transfer-Encoding</code></li>
520       <li><code>Upgrade</code></li>
521     </ul>
522
523     <p><directive>CacheIgnoreHeaders</directive> specifies additional HTTP
524     headers that should not to be stored in the cache.  For example, it makes
525     sense in some cases to prevent cookies from being stored in the cache.</p>
526
527     <p><directive>CacheIgnoreHeaders</directive> takes a space separated list
528     of HTTP headers that should not be stored in the cache. If only hop-by-hop
529     headers not should be stored in the cache (the RFC 2616 compliant
530     behaviour), <directive>CacheIgnoreHeaders</directive> can be set to
531     <code>None</code>.</p>
532
533     <example><title>Example 1</title>
534       CacheIgnoreHeaders Set-Cookie
535     </example>
536
537     <example><title>Example 2</title>
538       CacheIgnoreHeaders None
539     </example>
540
541     <note type="warning"><title>Warning:</title>
542       If headers like <code>Expires</code> which are needed for proper cache
543       management are not stored due to a
544       <directive>CacheIgnoreHeaders</directive> setting, the behaviour of
545       mod_cache is undefined.
546     </note>
547 </usage>
548 </directivesynopsis>
549
550 <directivesynopsis>
551 <name>CacheIgnoreURLSessionIdentifiers</name>
552 <description>Ignore defined session identifiers encoded in the URL when caching
553 </description>
554 <syntax>CacheIgnoreURLSessionIdentifiers <var>identifier</var> [<var>identifier</var>] ...</syntax>
555 <default>CacheIgnoreURLSessionIdentifiers None</default>
556 <contextlist><context>server config</context><context>virtual host</context>
557 </contextlist>
558
559 <usage>
560     <p>Sometimes applications encode the session identifier into the URL like in the following
561     Examples:
562     </p>
563     <ul>
564       <li><code>/someapplication/image.gif;jsessionid=123456789</code></li>
565       <li><code>/someapplication/image.gif?PHPSESSIONID=12345678</code></li>
566     </ul>
567     <p>This causes cachable resources to be stored separately for each session, which
568     is often not desired. <directive>CacheIgnoreURLSessionIdentifiers</directive> lets
569     define a list of identifiers that are removed from the key that is used to identify
570     an entity in the cache, such that cachable resources are not stored separately for
571     each session.
572     </p>
573     <p><code>CacheIgnoreURLSessionIdentifiers None</code> clears the list of ignored
574     identifiers. Otherwise, each identifier is added to the list.</p>
575
576     <example><title>Example 1</title>
577       CacheIgnoreURLSessionIdentifiers jsessionid
578     </example>
579
580     <example><title>Example 2</title>
581       CacheIgnoreURLSessionIdentifiers None
582     </example>
583
584 </usage>
585 </directivesynopsis>
586
587 <directivesynopsis>
588 <name>CacheStorePrivate</name>
589 <description>Attempt to cache responses that the server has marked as private</description>
590 <syntax>CacheStorePrivate On|Off</syntax>
591 <default>CacheStorePrivate Off</default>
592 <contextlist><context>server config</context><context>virtual host</context>
593 </contextlist>
594
595 <usage>
596     <p>Ordinarily, responses with Cache-Control: private header values will not
597        be stored in the cache.  The <directive>CacheStorePrivate</directive>
598        directive allows this behavior to be overridden.
599        <directive>CacheStorePrivate</directive> On
600        tells the server to attempt to cache the resource even if it contains
601        private header values.  Resources requiring authorization will
602        <em>never</em> be cached.</p>
603
604     <example>
605       CacheStorePrivate On
606     </example>
607
608     <note type="warning"><title>Warning:</title>
609        This directive will allow caching even if the upstream server has
610        requested that the resource not be cached.  This directive is only
611        ideal for a 'private' cache.
612     </note>
613 </usage>
614 <seealso><directive module="mod_cache">CacheIgnoreCacheControl</directive></seealso>
615 <seealso><directive module="mod_cache">CacheStoreNoStore</directive></seealso>
616 </directivesynopsis>
617
618 <directivesynopsis>
619 <name>CacheStoreNoStore</name>
620 <description>Attempt to cache requests or responses that have been marked as no-store.</description>
621 <syntax>CacheStoreNoStore On|Off</syntax>
622 <default>CacheStoreNoStore Off</default>
623 <contextlist><context>server config</context><context>virtual host</context>
624 </contextlist>
625
626 <usage>
627     <p>Ordinarily, requests or responses with Cache-Control: no-store header
628        values will not be stored in the cache.  The
629        <directive>CacheStoreNoCache</directive> directive allows this
630        behavior to be overridden.  <directive>CacheStoreNoCache</directive> On
631        tells the server to attempt to cache the resource even if it contains
632        no-store header values.  Resources requiring authorization will
633        <em>never</em> be cached.</p>
634
635     <example>
636       CacheStoreNoStore On
637     </example>
638
639     <note type="warning"><title>Warning:</title>
640        As described in RFC 2616, the no-store directive is intended to
641        "prevent the inadvertent release or retention of sensitive information
642        (for example, on backup tapes)."  Enabling this option could store
643        sensitive information in the cache.  You are hereby warned.
644     </note>
645 </usage>
646 <seealso><directive module="mod_cache">CacheIgnoreCacheControl</directive></seealso>
647 <seealso><directive module="mod_cache">CacheStorePrivate</directive></seealso>
648 </directivesynopsis>
649
650 <directivesynopsis>
651 <name>CacheLock</name>
652 <description>Enable the thundering herd lock.</description>
653 <syntax>CacheLock <var>on|off</var></syntax>
654 <default>CacheLock off</default>
655 <contextlist><context>server config</context><context>virtual host</context>
656 </contextlist>
657
658 <usage>
659   <p>The <directive>CacheLock</directive> directive enables the thundering herd lock
660   for the given URL space.</p>
661   
662   <p>In a minimal configuration the following directive is all that is needed to
663   enable the thundering herd lock in the default system temp directory.</p>
664
665   <example>
666     # Enable cache lock<br />
667     CacheLock on<br /><br />
668   </example>
669
670 </usage>
671 </directivesynopsis>
672
673 <directivesynopsis>
674 <name>CacheLockPath</name>
675 <description>Set the lock path directory.</description>
676 <syntax>CacheLockPath <var>directory</var></syntax>
677 <default>CacheLockPath /tmp/mod_cache-lock</default>
678 <contextlist><context>server config</context><context>virtual host</context>
679 </contextlist>
680     
681 <usage>
682   <p>The <directive>CacheLockPath</directive> directive allows you to specify the
683   directory in which the locks are created. By default, the system's temporary
684   folder is used. Locks consist of empty files that only exist for stale URLs
685   in flight, so is significantly less resource intensive than the traditional
686   disk cache.</p>
687
688 </usage>
689 </directivesynopsis>
690
691 <directivesynopsis>
692 <name>CacheLockMaxAge</name>
693 <description>Set the maximum possible age of a cache lock.</description>
694 <syntax>CacheLockMaxAge <var>integer</var></syntax>
695 <default>CacheLockMaxAge 5</default>
696 <contextlist><context>server config</context><context>virtual host</context>
697 </contextlist>
698     
699 <usage>
700   <p>The <directive>CacheLockMaxAge</directive> directive specifies the maximum
701   age of any cache lock.</p>
702   
703   <p>A lock older than this value in seconds will be ignored, and the next
704   incoming request will be given the opportunity to re-establish the lock.
705   This mechanism prevents a slow client taking an excessively long time to refresh
706   an entity.</p>
707   
708 </usage>
709 </directivesynopsis>
710
711 <directivesynopsis>
712   <name>CacheQuickHandler</name>
713   <description>Run the cache from the quick handler.</description>
714   <syntax>CacheQuickHandler <var>on|off</var></syntax>
715   <default>CacheQuickHandler on</default>
716   <contextlist><context>server config</context><context>virtual host</context>
717   </contextlist>
718
719   <usage>
720     <p>The <directive module="mod_cache">CacheQuickHandler</directive> directive
721     controls the phase in which the cache is handled.</p>
722
723     <p>In the default enabled configuration, the cache operates within the quick
724     handler phase. This phase short circuits the majority of server processing,
725     and represents the most performant mode of operation for a typical server.
726     The cache <strong>bolts onto</strong> the front of the server, and the
727     majority of server processing is avoided.</p>
728
729     <p>When disabled, the cache operates as a normal handler, and is subject to
730     the full set of phases when handling a server request. While this mode is
731     slower than the default, it allows the cache to be used in cases where full
732     processing is required, such as when content is subject to authorisation.</p>
733
734     <example>
735       # Run cache as a normal handler<br />
736       CacheQuickHandler off<br /><br />
737     </example>
738
739     <p>It is also possible, when the quick handler is disabled, for the
740     administrator to choose the precise location within the filter chain where
741     caching is to be performed, by adding the <strong>CACHE</strong> filter to
742     the chain.</p>
743
744     <example>
745       # Cache content before mod_include and mod_deflate<br />
746       CacheQuickHandler off<br />
747       AddOutputFilterByType CACHE;INCLUDES;DEFLATE text/html<br /><br />
748     </example>
749
750     <p>If the CACHE filter is specified more than once, the last instance will
751     apply.</p>
752
753   </usage>
754 </directivesynopsis>
755   
756 </modulesynopsis>