📄 mod_cache.html.en
字号:
</code></p></div></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="CacheEnable" id="CacheEnable">CacheEnable</a> <a name="cacheenable" id="cacheenable">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable caching of specified URLs using a specified storagemanager</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheEnable <var>cache_type</var> <var>url-string</var></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_cache</td></tr></table> <p>The <code class="directive">CacheEnable</code> directive instructs <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code> to cache urls at or below <var>url-string</var>. The cache storage manager is specified with the <var>cache_type</var> argument. <var>cache_type</var> <code> mem</code> instructs <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code> to use the memory based storage manager implemented by <code class="module"><a href="../mod/mod_mem_cache.html">mod_mem_cache</a></code>. <var>cache_type</var> <code>disk</code> instructs <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code> to use the disk based storage manager implemented by <code class="module"><a href="../mod/mod_disk_cache.html">mod_disk_cache</a></code>. <var>cache_type</var> <code>fd</code> instructs <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code> to use the file descriptor cache implemented by <code class="module"><a href="../mod/mod_mem_cache.html">mod_mem_cache</a></code>.</p> <p>In the event that the URL space overlaps between different <code class="directive">CacheEnable</code> directives (as in the example below), each possible storage manager will be run until the first one that actually processes the request. The order in which the storage managers are run is determined by the order of the <code class="directive">CacheEnable</code> directives in the configuration file.</p> <div class="example"><p><code> CacheEnable mem /manual<br /> CacheEnable fd /images<br /> CacheEnable disk /<br /> </code></p></div> <p>When acting as a forward proxy server, <var>url-string</var> can also be used to specify remote sites and proxy protocols which caching should be enabled for.</p> <div class="example"><p><code> # Cache proxied url's<br /> CacheEnable disk /<br /><br /> # Cache FTP-proxied url's<br /> CacheEnable disk ftp://<br /><br /> # Cache content from www.apache.org<br /> CacheEnable disk http://www.apache.org/<br /> </code></p></div></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="CacheIgnoreCacheControl" id="CacheIgnoreCacheControl">CacheIgnoreCacheControl</a> <a name="cacheignorecachecontrol" id="cacheignorecachecontrol">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Ignore request to not serve cached content to client</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheIgnoreCacheControl On|Off</code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CacheIgnoreCacheControl Off</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_cache</td></tr></table> <p>Ordinarily, requests containing a Cache-Control: no-cache or Pragma: no-cache header value will not be served from the cache. The <code class="directive">CacheIgnoreCacheControl</code> directive allows this behavior to be overridden. <code class="directive">CacheIgnoreCacheControl</code> On tells the server to attempt to serve the resource from the cache even if the request contains no-cache header values. Resources requiring authorization will <em>never</em> be cached.</p> <div class="example"><p><code> CacheIgnoreCacheControl On </code></p></div> <div class="warning"><h3>Warning:</h3> This directive will allow serving from the cache even if the client has requested that the document not be served from the cache. This might result in stale content being served. </div><h3>See also</h3><ul><li><code class="directive"><a href="#cachestoreprivate">CacheStorePrivate</a></code></li><li><code class="directive"><a href="#cachestorenostore">CacheStoreNoStore</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="CacheIgnoreHeaders" id="CacheIgnoreHeaders">CacheIgnoreHeaders</a> <a name="cacheignoreheaders" id="cacheignoreheaders">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Do not store the given HTTP header(s) in the cache.</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheIgnoreHeaders <var>header-string</var> [<var>header-string</var>] ...</code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CacheIgnoreHeaders None</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_cache</td></tr></table> <p>According to RFC 2616, hop-by-hop HTTP headers are not stored in the cache. The following HTTP headers are hop-by-hop headers and thus do not get stored in the cache in <em>any</em> case regardless of the setting of <code class="directive">CacheIgnoreHeaders</code>:</p> <ul> <li><code>Connection</code></li> <li><code>Keep-Alive</code></li> <li><code>Proxy-Authenticate</code></li> <li><code>Proxy-Authorization</code></li> <li><code>TE</code></li> <li><code>Trailers</code></li> <li><code>Transfer-Encoding</code></li> <li><code>Upgrade</code></li> </ul> <p><code class="directive">CacheIgnoreHeaders</code> specifies additional HTTP headers that should not to be stored in the cache. For example, it makes sense in some cases to prevent cookies from being stored in the cache.</p> <p><code class="directive">CacheIgnoreHeaders</code> takes a space separated list of HTTP headers that should not be stored in the cache. If only hop-by-hop headers not should be stored in the cache (the RFC 2616 compliant behaviour), <code class="directive">CacheIgnoreHeaders</code> can be set to <code>None</code>.</p> <div class="example"><h3>Example 1</h3><p><code> CacheIgnoreHeaders Set-Cookie </code></p></div> <div class="example"><h3>Example 2</h3><p><code> CacheIgnoreHeaders None </code></p></div> <div class="warning"><h3>Warning:</h3> If headers like <code>Expires</code> which are needed for proper cache management are not stored due to a <code class="directive">CacheIgnoreHeaders</code> setting, the behaviour of mod_cache is undefined. </div></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="CacheIgnoreNoLastMod" id="CacheIgnoreNoLastMod">CacheIgnoreNoLastMod</a> <a name="cacheignorenolastmod" id="cacheignorenolastmod">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Ignore the fact that a response has no Last Modifiedheader.</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheIgnoreNoLastMod On|Off</code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CacheIgnoreNoLastMod Off</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_cache</td></tr></table> <p>Ordinarily, documents without a last-modified date are not cached. Under some circumstances the last-modified date is removed (during <code class="module"><a href="../mod/mod_include.html">mod_include</a></code> processing for example) or not provided at all. The <code class="directive">CacheIgnoreNoLastMod</code> directive provides a way to specify that documents without last-modified dates should be considered for caching, even without a last-modified date. If neither a last-modified date nor an expiry date are provided with the document then the value specified by the <code class="directive">CacheDefaultExpire</code> directive will be used to generate an expiration date.</p> <div class="example"><p><code> CacheIgnoreNoLastMod On
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -