]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_cache_disk.html.en
5d290eabdd314a7199f2804ab1afc6724fc6d168
[apache] / docs / manual / mod / mod_cache_disk.html.en
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5               This file is generated from xml source: DO NOT EDIT
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7       -->
8 <title>mod_cache_disk - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
13 <body>
14 <div id="page-header">
15 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16 <p class="apache">Apache HTTP Server Version 2.3</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
19 <div id="path">
20 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.3</a> &gt; <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Module mod_cache_disk</h1>
23 <div class="toplang">
24 <p><span>Available Languages: </span><a href="../en/mod/mod_cache_disk.html" title="English">&nbsp;en&nbsp;</a> |
25 <a href="../fr/mod/mod_cache_disk.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
26 <a href="../ja/mod/mod_cache_disk.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
27 <a href="../ko/mod/mod_cache_disk.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
28 </div>
29 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Disk based storage module for the HTTP caching filter.</td></tr>
30 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
31 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>cache_disk_module</td></tr>
32 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_cache_disk.c</td></tr></table>
33 <h3>Summary</h3>
34
35     <p><code class="module"><a href="../mod/mod_cache_disk.html">mod_cache_disk</a></code> implements a disk based storage
36     manager for <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code>.</p>
37
38     <p>The headers and bodies of cached responses are stored separately on
39     disk, in a directory structure derived from the md5 hash of the cached
40     URL.</p>
41
42     <p>Multiple content negotiated responses can be stored concurrently,
43     however the caching of partial content is not yet supported by this
44     module.</p>
45
46     <p>Atomic cache updates to both header and body files are achieved
47     without the need for locking by storing the device and inode numbers of
48     the body file within the header file. This has the side effect that
49     cache entries manually moved into the cache will be ignored.</p>
50
51     <p>The <code class="program"><a href="../programs/htcacheclean.html">htcacheclean</a></code> tool is provided to list cached
52     URLs, remove cached URLs, or to maintain the size of the disk cache
53     within size and/or inode limits. The tool can be run on demand, or
54     can be daemonized to offer continuous monitoring of directory sizes.</p>
55
56     <div class="note"><h3>Note:</h3>
57       <p><code class="module"><a href="../mod/mod_cache_disk.html">mod_cache_disk</a></code> requires the services of
58       <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code>, which must be
59       loaded before mod_cache_disk.</p>
60     </div>
61     <div class="note"><h3>Note:</h3>
62       <p><code class="module"><a href="../mod/mod_cache_disk.html">mod_cache_disk</a></code> uses the sendfile feature to
63       serve files from the cache when supported by the platform, and
64       when enabled with <code class="directive"><a href="../mod/core.html#enablesendfile">EnableSendfile</a></code>.
65       However, per-directory and .htaccess configuration of
66       <code class="directive"><a href="../mod/core.html#enablesendfile">EnableSendfile</a></code> are ignored by
67       <code class="module"><a href="../mod/mod_cache_disk.html">mod_cache_disk</a></code> as the corresponding settings are not
68       available to the module when a request is being served from the
69       cache.</p>
70     </div>
71 </div>
72 <div id="quickview"><h3 class="directives">Directives</h3>
73 <ul id="toc">
74 <li><img alt="" src="../images/down.gif" /> <a href="#cachedirlength">CacheDirLength</a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#cachedirlevels">CacheDirLevels</a></li>
76 <li><img alt="" src="../images/down.gif" /> <a href="#cachemaxfilesize">CacheMaxFileSize</a></li>
77 <li><img alt="" src="../images/down.gif" /> <a href="#cacheminfilesize">CacheMinFileSize</a></li>
78 <li><img alt="" src="../images/down.gif" /> <a href="#cachereadsize">CacheReadSize</a></li>
79 <li><img alt="" src="../images/down.gif" /> <a href="#cachereadtime">CacheReadTime</a></li>
80 <li><img alt="" src="../images/down.gif" /> <a href="#cacheroot">CacheRoot</a></li>
81 </ul>
82 </div>
83
84 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
85 <div class="directive-section"><h2><a name="CacheDirLength" id="CacheDirLength">CacheDirLength</a> <a name="cachedirlength" id="cachedirlength">Directive</a></h2>
86 <table class="directive">
87 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The number of characters in subdirectory names</td></tr>
88 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheDirLength <var>length</var></code></td></tr>
89 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CacheDirLength 2</code></td></tr>
90 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
91 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
92 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_cache_disk</td></tr>
93 </table>
94     <p>The <code class="directive">CacheDirLength</code> directive sets the number
95     of characters for each subdirectory name in the cache hierarchy. It can
96     be used in conjunction with <code class="directive">CacheDirLevels</code> to
97     determine the approximate structure of your cache hierarchy.</p>
98     <p>A high value for <code class="directive">CacheDirLength</code> combined
99     with a low value for <code class="directive">CacheDirLevels</code> will result in
100     a relatively flat hierarchy, with a large number of subdirectories at each
101     level.</p>
102
103     <div class="note">
104       <p>The result of <code class="directive"><a href="#cachedirlevels">CacheDirLevels</a></code>* <code class="directive">CacheDirLength</code>
105       must not be higher than 20.</p>
106     </div>
107
108
109 </div>
110 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
111 <div class="directive-section"><h2><a name="CacheDirLevels" id="CacheDirLevels">CacheDirLevels</a> <a name="cachedirlevels" id="cachedirlevels">Directive</a></h2>
112 <table class="directive">
113 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The number of levels of subdirectories in the
114 cache.</td></tr>
115 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheDirLevels <var>levels</var></code></td></tr>
116 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CacheDirLevels 2</code></td></tr>
117 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
118 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
119 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_cache_disk</td></tr>
120 </table>
121     <p>The <code class="directive">CacheDirLevels</code> directive sets the number
122     of subdirectory levels in the cache. Cached data will be saved this
123     many directory levels below the <code class="directive"><a href="#cacheroot">CacheRoot</a></code> directory.</p>
124     <p>A high value for <code class="directive">CacheDirLevels</code> combined
125     with a low value for <code class="directive">CacheDirLength</code> will result in
126     a relatively deep hierarchy, with a small number of subdirectories at each
127     level.</p>
128
129     <div class="note">
130       <p>The result of <code class="directive">CacheDirLevels</code>*
131       <code class="directive"><a href="#cachedirlength">CacheDirLength</a></code> must
132       not be higher than 20.</p>
133     </div>
134
135
136 </div>
137 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
138 <div class="directive-section"><h2><a name="CacheMaxFileSize" id="CacheMaxFileSize">CacheMaxFileSize</a> <a name="cachemaxfilesize" id="cachemaxfilesize">Directive</a></h2>
139 <table class="directive">
140 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The maximum size (in bytes) of a document to be placed in the
141 cache</td></tr>
142 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheMaxFileSize <var>bytes</var></code></td></tr>
143 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CacheMaxFileSize 1000000</code></td></tr>
144 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
145 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
146 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_cache_disk</td></tr>
147 </table>
148     <p>The <code class="directive">CacheMaxFileSize</code> directive sets the
149     maximum size, in bytes, for a document to be considered for storage in
150     the cache.</p>
151
152     <div class="example"><p><code>
153       CacheMaxFileSize 64000
154     </code></p></div>
155
156 </div>
157 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
158 <div class="directive-section"><h2><a name="CacheMinFileSize" id="CacheMinFileSize">CacheMinFileSize</a> <a name="cacheminfilesize" id="cacheminfilesize">Directive</a></h2>
159 <table class="directive">
160 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The minimum size (in bytes) of a document to be placed in the
161 cache</td></tr>
162 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheMinFileSize <var>bytes</var></code></td></tr>
163 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CacheMinFileSize 1</code></td></tr>
164 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
165 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
166 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_cache_disk</td></tr>
167 </table>
168     <p>The <code class="directive">CacheMinFileSize</code> directive sets the
169     minimum size, in bytes, for a document to be considered for storage
170     in the cache.</p>
171
172     <div class="example"><p><code>
173       CacheMinFileSize 64
174     </code></p></div>
175
176 </div>
177 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
178 <div class="directive-section"><h2><a name="CacheReadSize" id="CacheReadSize">CacheReadSize</a> <a name="cachereadsize" id="cachereadsize">Directive</a></h2>
179 <table class="directive">
180 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The minimum size (in bytes) of the document to read and be cached
181   before sending the data downstream</td></tr>
182 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheReadSize <var>bytes</var></code></td></tr>
183 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CacheReadSize 0</code></td></tr>
184 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
185 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
186 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_cache_disk</td></tr>
187 </table>
188     <p>The <code class="directive">CacheReadSize</code> directive sets the
189     minimum amount of data, in bytes, to be read from the backend before the
190     data is sent to the client. The default of zero causes all data read of
191     any size to be passed downstream to the client immediately as it arrives.
192     Setting this to a higher value causes the disk cache to buffer at least
193     this amount before sending the result to the client. This can improve
194     performance when caching content from a reverse proxy.</p>
195
196     <p>This directive only takes effect when the data is being saved to the
197     cache, as opposed to data being served from the cache.</p>
198
199     <div class="example"><p><code>
200       CacheReadSize 102400
201     </code></p></div>
202
203 </div>
204 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
205 <div class="directive-section"><h2><a name="CacheReadTime" id="CacheReadTime">CacheReadTime</a> <a name="cachereadtime" id="cachereadtime">Directive</a></h2>
206 <table class="directive">
207 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The minimum time (in milliseconds) that should elapse while reading
208   before data is sent downstream</td></tr>
209 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheReadTime <var>milliseconds</var></code></td></tr>
210 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CacheReadTime 0</code></td></tr>
211 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
212 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
213 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_cache_disk</td></tr>
214 </table>
215     <p>The <code class="directive">CacheReadTime</code> directive sets the minimum amount
216     of elapsed time that should pass before making an attempt to send data
217     downstream to the client. During the time period, data will be buffered
218     before sending the result to the client. This can improve performance when
219     caching content from a reverse proxy.</p>
220
221     <p>The default of zero disables this option.</p>
222
223     <p>This directive only takes effect when the data is being saved to the
224     cache, as opposed to data being served from the cache. It is recommended
225     that this option be used alongside the
226     <code class="directive"><a href="#cachereadsize">CacheReadSize</a></code> directive to
227     ensure that the server does not buffer excessively should data arrive faster
228     than expected.</p>
229
230     <div class="example"><p><code>
231       CacheReadTime 1000
232     </code></p></div>
233
234 </div>
235 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
236 <div class="directive-section"><h2><a name="CacheRoot" id="CacheRoot">CacheRoot</a> <a name="cacheroot" id="cacheroot">Directive</a></h2>
237 <table class="directive">
238 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The directory root under which cache files are
239 stored</td></tr>
240 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheRoot <var>directory</var></code></td></tr>
241 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
242 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
243 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_cache_disk</td></tr>
244 </table>
245     <p>The <code class="directive">CacheRoot</code> directive defines the name of
246     the directory on the disk to contain cache files. If the <code class="module"><a href="../mod/mod_cache_disk.html">mod_cache_disk</a></code> module has been loaded or compiled in to the
247     Apache server, this directive <em>must</em> be defined. Failing to
248     provide a value for <code class="directive">CacheRoot</code> will result in
249     a configuration file processing error. The <code class="directive"><a href="#cachedirlevels">CacheDirLevels</a></code> and <code class="directive"><a href="#cachedirlength">CacheDirLength</a></code> directives define
250     the structure of the directories under the specified root directory.</p>
251
252     <div class="example"><p><code>
253       CacheRoot c:/cacheroot
254     </code></p></div>
255
256 </div>
257 </div>
258 <div class="bottomlang">
259 <p><span>Available Languages: </span><a href="../en/mod/mod_cache_disk.html" title="English">&nbsp;en&nbsp;</a> |
260 <a href="../fr/mod/mod_cache_disk.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
261 <a href="../ja/mod/mod_cache_disk.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
262 <a href="../ko/mod/mod_cache_disk.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
263 </div><div id="footer">
264 <p class="apache">Copyright 2011 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
265 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
266 </body></html>