mod_cache.xml revision 5d1b3dcc11d17d2a508d9836e4b1787c65a8d789
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
e942c741056732f50da2074b36fe59805d370650slive<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<modulesynopsis>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard<description>Content cache keyed to URIs.</description>
88c775368960b64afcdfd93a812f466a109746baerikabele This module is experimental. Documentation is still under development...
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <p>mod_cache implements an RFC 2616 compliant HTTP content
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard cache that can be used to cache either local or proxied content.
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard mod_cache requires the services of one or more storage
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard management modules. Two storage management modules are included in
3e5f26422e7931e8838f3c844adc4282ef269cdfstoddard the base Apache distribution:</p>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <dd>implements a disk based storage manager for use with <module>mod_proxy</module></dd>
3ec4de296cf8eb31d8a59811b58720efafccf109patrikj <dd>implements an in-memory based storage manager. mod_mem_cache
3e5f26422e7931e8838f3c844adc4282ef269cdfstoddard can be configured to operate in two modes: caching open file
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard descriptors or caching objects in heap storage. <em><module>mod_mem_cache</module></em>
3e5f26422e7931e8838f3c844adc4282ef269cdfstoddard is most useful when used to cache locally generated content or to cache
3ec4de296cf8eb31d8a59811b58720efafccf109patrikj backend server content for mod_proxy configured for ProxyPass (aka <em>reverse proxy</em>)</dd>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <p>Content stored and retrived keyed to the URL. Content with
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard access protections is not cached.</p>
88c775368960b64afcdfd93a812f466a109746baerikabele<section id="related"><title>Related Modules and Directives</title>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <modulelist>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard </modulelist>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directivelist>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheRoot</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheSize</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheGcInterval</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheDirLevels</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheDirLength</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheExpiryCheck</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheMinFileSize</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheMaxFileSize</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheTimeMargin</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheGcDaily</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheGcUnused</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheGcClean</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheGcMemUsage</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_mem_cache">MCacheSize</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_mem_cache">MCacheMaxObjectCount</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_mem_cache">MCacheMinObjectSize</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_mem_cache">MCacheMaxObjectSize</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_mem_cache">MCacheRemovalAlgorithm</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard </directivelist>
7d2c654eb12a943bb763fc218337545e543ac2eberikabele# Sample Cache Configuration <br />
7d2c654eb12a943bb763fc218337545e543ac2eberikabeleLoadModule cache_module modules/mod_cache.so <br />
7d2c654eb12a943bb763fc218337545e543ac2eberikabele#LoadModule disk_cache_module modules/mod_disk_cache.so <br />
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard CacheRoot c:/cacheroot <br />
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard CacheSize 256 <br />
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard CacheEnable disk / <br />
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard CacheDirLevels 5 <br />
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard CacheDirLength 3 <br />
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard </IfModule> <br />
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard LoadModule mem_cache_module modules/mod_mem_cache.so <br />
3e5f26422e7931e8838f3c844adc4282ef269cdfstoddard MCacheEnable mem / <br />
3e5f26422e7931e8838f3c844adc4282ef269cdfstoddard MCacheSize 4096 <br />
3e5f26422e7931e8838f3c844adc4282ef269cdfstoddard MCacheMaxObjectCount 100 <br />
3e5f26422e7931e8838f3c844adc4282ef269cdfstoddard MCacheMinObjectSize 1 <br />
3e5f26422e7931e8838f3c844adc4282ef269cdfstoddard MCacheMaxObjectSize 2048 <br />
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard </IfModule> <br />
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</IfModule> <br />
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<description>Enable caching specified URLs in a specified storage manager</description>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<syntax>CacheEnable <em>cache_type </em><em> url-string</em></syntax>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<contextlist><context>server config</context></contextlist>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <p>The <directive>CacheEnable</directive> directive instructs
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard mod_cache to cache urls at or below <em>url-string</em>.
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard The cache store is specified with the <em>cache_type</em> argument.
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <em>cache_type </em> <em> mem</em> instructs mod_cache to use the
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard in-memory cache storage manager implemented by <em>mod_mem_cache</em>.
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <em>cache_type </em> <em> disk</em> instructs mod_cache to use the
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard cache storage manager implemented by <em>mod_disk_cache </em>. </p>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard CacheEnable disk / <br />
3e5f26422e7931e8838f3c844adc4282ef269cdfstoddard CacheEnable mem /manual <br />
3e5f26422e7931e8838f3c844adc4282ef269cdfstoddard CacheEnable fd /images <br />
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<description>Disable caching of specified URLs by specified storage manager</description>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<syntax>CacheDisable <em>cache_type </em> <em> url-string</em></syntax>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<contextlist><context>server config</context></contextlist>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <p>The <directive>CacheDisable</directive> directive instructs
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard mod_cache to <em>not</em> cache urls at or above <em>url-string</em>.</p>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard CacheDisable disk /local_files
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<description>The maximum time in seconds to cache a document</description>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<contextlist><context>server config</context></contextlist>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <p>The maximum time in seconds to cache a document. The <directive>CacheMaxExpire</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard takes precedence over the <em>Expire</em> field from the header.</p>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard CacheMaxExpire 604800
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard<syntax>CacheDefaultExpire <em>seconds</em></syntax>
88c775368960b64afcdfd93a812f466a109746baerikabele<default>CacheDefaultExpire 3600 (one hour)</default>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<contextlist><context>server config</context></contextlist>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <p>The default time in seconds to cache a document if the page does not have
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard CacheDefaultExpire 86400
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<description>Ignore responses where there is no Last Modified Header</description>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<contextlist><context>server config</context></contextlist>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <p>Ignore responses where there is no Last Modified Header</p>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard CacheIgnoreNoLastMod
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<description>Ignore requests from the client for uncached content</description>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<contextlist><context>server config</context></contextlist>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <p>Ignore requests from the client for uncached content</p>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard CacheIgnoreNoLastMod
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<description>The factor used to estimate the Expires date from the LastModified date</description>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard<syntax>CacheLastModifiedFactor <em>float</em></syntax>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<contextlist><context>server config</context></contextlist>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <p>The factor used to estimate the Expires date from the LastModified date.</p>
97a9a944b5887e91042b019776c41d5dd74557aferikabele CacheLastModifiedFactor 0.5
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard<directivesynopsis>
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabele<description>Percentage of download to arrive for the cache to force complete transfer</description>
97a9a944b5887e91042b019776c41d5dd74557aferikabele<syntax>CacheForceCompletion <em>Percentage</em></syntax>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard<contextlist><context>server config</context></contextlist>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <p>Percentage of download to arrive for the cache to force complete transfert.</p>
97a9a944b5887e91042b019776c41d5dd74557aferikabele CacheForceCompletion 80
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabele</directivesynopsis>
e2c93125be350d68b887588471746a87c89f9d6bbrianp<directivesynopsis>
e2c93125be350d68b887588471746a87c89f9d6bbrianp<description>Maximum amount of a streamed response to buffer in memory before declaring the response uncacheable</description>
e2c93125be350d68b887588471746a87c89f9d6bbrianp<syntax>CacheMaxStreamingBuffer <em>size_in_bytes</em></syntax>
e2c93125be350d68b887588471746a87c89f9d6bbrianp<contextlist><context>server config</context></contextlist>
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabele<p>Maximum number of bytes of a streamed response (i.e., a response where
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabelethe entire content is not available all at once, such as a proxy or CGI
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabeleresponse) to buffer before deciding if the response is cacheable. By
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabeledefault, a streamed response will <em>not</em> be cached unless it has a
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabeleContent-Length header. The reason for this is to avoid using a large amount
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabeleof memory to buffer a partial response that might end up being too large
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabeleto fit in the cache anyway. To enable caching of streamed responses, use
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabeleCacheMaxStreamingBuffer to specify the maximum amount of buffer space to use
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabeleper request.</p>
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabele<p>Note: Using a nonzero value for CacheMaxStreamingBuffer will not delay the
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabeletransmission of the response to the client. As soon as mod_cache copies a
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabeleblock of streamed content into a buffer, it sends the block on to the next
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabeleoutput filter for delivery to the client.</p>
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabele# Enable caching of streamed responses up to 64KB:<br />
5d1b3dcc11d17d2a508d9836e4b1787c65a8d789erikabeleCacheMaxStreamingBuffer 65536
e2c93125be350d68b887588471746a87c89f9d6bbrianp</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</modulesynopsis>