]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_mem_cache.html.en
Adding updated mod_ssl HOWTO to the website
[apache] / docs / manual / mod / mod_mem_cache.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_mem_cache - 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_mem_cache</h1>
23 <div class="toplang">
24 <p><span>Available Languages: </span><a href="../en/mod/mod_mem_cache.html" title="English">&nbsp;en&nbsp;</a> |
25 <a href="../ja/mod/mod_mem_cache.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
26 <a href="../ko/mod/mod_mem_cache.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
27 </div>
28 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Content cache keyed to URIs</td></tr>
29 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
30 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>mem_cache_module</td></tr>
31 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_mem_cache.c</td></tr></table>
32 <h3>Summary</h3>
33
34     <p>This module <em>requires</em> the service of <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code>. It acts as a support module for <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code> and provides a memory based storage manager.
35     <code class="module"><a href="../mod/mod_mem_cache.html">mod_mem_cache</a></code> can be configured to operate in two
36     modes: caching open file descriptors or caching objects in heap storage.
37     <code class="module"><a href="../mod/mod_mem_cache.html">mod_mem_cache</a></code> is most useful when used to cache locally
38     generated content or to cache backend server content for <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> configured for <code class="directive"><a href="../mod/mod_proxy.html#proxypass">ProxyPass</a></code> (aka <dfn>reverse proxy</dfn>).</p>
39
40     <p>Content is stored in and retrieved from the cache using URI based
41     keys. Content with access protection is not cached.</p>
42 </div>
43 <div id="quickview"><h3 class="directives">Directives</h3>
44 <ul id="toc">
45 <li><img alt="" src="../images/down.gif" /> <a href="#mcachemaxobjectcount">MCacheMaxObjectCount</a></li>
46 <li><img alt="" src="../images/down.gif" /> <a href="#mcachemaxobjectsize">MCacheMaxObjectSize</a></li>
47 <li><img alt="" src="../images/down.gif" /> <a href="#mcachemaxstreamingbuffer">MCacheMaxStreamingBuffer</a></li>
48 <li><img alt="" src="../images/down.gif" /> <a href="#mcacheminobjectsize">MCacheMinObjectSize</a></li>
49 <li><img alt="" src="../images/down.gif" /> <a href="#mcacheremovalalgorithm">MCacheRemovalAlgorithm</a></li>
50 <li><img alt="" src="../images/down.gif" /> <a href="#mcachesize">MCacheSize</a></li>
51 </ul>
52 <h3>See also</h3>
53 <ul class="seealso">
54 <li><code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code></li>
55 <li><code class="module"><a href="../mod/mod_disk_cache.html">mod_disk_cache</a></code></li>
56 </ul></div>
57
58 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
59 <div class="directive-section"><h2><a name="MCacheMaxObjectCount" id="MCacheMaxObjectCount">MCacheMaxObjectCount</a> <a name="mcachemaxobjectcount" id="mcachemaxobjectcount">Directive</a></h2>
60 <table class="directive">
61 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The maximum number of objects allowed to be placed in the
62 cache</td></tr>
63 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MCacheMaxObjectCount <var>value</var></code></td></tr>
64 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MCacheMaxObjectCount 1009</code></td></tr>
65 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
66 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
67 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mem_cache</td></tr>
68 </table>
69     <p>The <code class="directive">MCacheMaxObjectCount</code> directive sets the
70     maximum number of objects to be cached. The value is used to create the
71     open hash table. If a new object needs to be inserted in the cache and
72     the maximum number of objects has been reached, an object will be
73     removed to allow the new object to be cached. The object to be removed
74     is selected using the algorithm specified by <code class="directive"><a href="#mcacheremovalalgorithm">MCacheRemovalAlgorithm</a></code>.</p>
75
76     <div class="example"><h3>Example</h3><p><code>
77       MCacheMaxObjectCount 13001
78     </code></p></div>
79
80 </div>
81 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
82 <div class="directive-section"><h2><a name="MCacheMaxObjectSize" id="MCacheMaxObjectSize">MCacheMaxObjectSize</a> <a name="mcachemaxobjectsize" id="mcachemaxobjectsize">Directive</a></h2>
83 <table class="directive">
84 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The maximum size (in bytes) of a document allowed in the
85 cache</td></tr>
86 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MCacheMaxObjectSize <var>bytes</var></code></td></tr>
87 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MCacheMaxObjectSize 10000</code></td></tr>
88 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
89 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
90 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mem_cache</td></tr>
91 </table>
92     <p>The <code class="directive">MCacheMaxObjectSize</code> directive sets the
93     maximum allowable size, in bytes, of a document for it to be considered
94     cacheable.</p>
95
96     <div class="example"><h3>Example</h3><p><code>
97       MCacheMaxObjectSize 6400000
98     </code></p></div>
99
100     <div class="note"><h3>Note</h3>
101       <p>The value of <code class="directive">MCacheMaxObjectSize</code> must be
102       greater than the value specified by the <code class="directive"><a href="#mcacheminobjectsize">MCacheMinObjectSize</a></code> directive.</p>
103     </div>
104
105 </div>
106 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
107 <div class="directive-section"><h2><a name="MCacheMaxStreamingBuffer" id="MCacheMaxStreamingBuffer">MCacheMaxStreamingBuffer</a> <a name="mcachemaxstreamingbuffer" id="mcachemaxstreamingbuffer">Directive</a></h2>
108 <table class="directive">
109 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum amount of a streamed response to buffer in memory
110 before declaring the response uncacheable</td></tr>
111 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MCacheMaxStreamingBuffer <var>size_in_bytes</var></code></td></tr>
112 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MCacheMaxStreamingBuffer the smaller of 100000 or MCacheMaxObjectSize</code></td></tr>
113 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
114 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
115 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mem_cache</td></tr>
116 </table>
117     <p>The <code class="directive">MCacheMaxStreamingBuffer</code> directive
118     specifies the maximum number of bytes of a streamed response to
119     buffer before deciding that the response is too big to cache.
120     A streamed response is one in which the entire content is not
121     immediately available and in which the <code>Content-Length</code>
122     may not be known. Sources of streaming responses include proxied
123     responses and the output of CGI scripts. By default, a streamed
124     response will <em>not</em> be cached unless it has a
125     <code>Content-Length</code> header. The reason for this is to
126     avoid using a large amount of memory to buffer a partial response
127     that might end up being too large to fit in the cache.
128     The <code class="directive">MCacheMaxStreamingBuffer</code> directive allows
129     buffering of streamed responses that don't contain a
130     <code>Content-Length</code> up to the specified maximum amount of
131     space. If the maximum buffer space is reached, the buffered
132     content is discarded and the attempt to cache is abandoned.</p>
133
134     <div class="note"><h3>Note:</h3>
135       <p>Using a nonzero value for <code class="directive">MCacheMaxStreamingBuffer</code> 
136       will not delay the transmission of the response to the client.
137       As soon as <code class="module"><a href="../mod/mod_mem_cache.html">mod_mem_cache</a></code> copies a block of streamed
138       content into a buffer, it sends the block on to the next output
139       filter for delivery to the client.</p>
140     </div>
141
142     <div class="example"><p><code>
143       # Enable caching of streamed responses up to 64KB:<br />
144       MCacheMaxStreamingBuffer 65536
145     </code></p></div>
146
147 </div>
148 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
149 <div class="directive-section"><h2><a name="MCacheMinObjectSize" id="MCacheMinObjectSize">MCacheMinObjectSize</a> <a name="mcacheminobjectsize" id="mcacheminobjectsize">Directive</a></h2>
150 <table class="directive">
151 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The minimum size (in bytes) of a document to be allowed in the
152 cache</td></tr>
153 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MCacheMinObjectSize <var>bytes</var></code></td></tr>
154 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MCacheMinObjectSize 0</code></td></tr>
155 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
156 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
157 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mem_cache</td></tr>
158 </table>
159     <p>The <code class="directive">MCacheMinObjectSize</code> directive sets the
160     minimum size in bytes of a document for it to be considered
161     cacheable.</p>
162
163     <div class="example"><h3>Example</h3><p><code>
164       MCacheMinObjectSize 10000
165     </code></p></div>
166
167 </div>
168 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
169 <div class="directive-section"><h2><a name="MCacheRemovalAlgorithm" id="MCacheRemovalAlgorithm">MCacheRemovalAlgorithm</a> <a name="mcacheremovalalgorithm" id="mcacheremovalalgorithm">Directive</a></h2>
170 <table class="directive">
171 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The algorithm used to select documents for removal from the
172 cache</td></tr>
173 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MCacheRemovalAlgorithm LRU|GDSF</code></td></tr>
174 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MCacheRemovalAlgorithm GDSF</code></td></tr>
175 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
176 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
177 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mem_cache</td></tr>
178 </table>
179     <p>The <code class="directive">MCacheRemovalAlgorithm</code> directive specifies
180     the algorithm used to select documents for removal from the cache.
181     Two choices are available:</p>
182
183     <dl>
184       <dt><code>LRU</code> (Least Recently Used)</dt>
185       <dd><code>LRU</code> removes the documents that have not been accessed
186       for the longest time.</dd>
187
188       <dt><code>GDSF</code> (GreadyDual-Size)</dt>
189       <dd><code>GDSF</code> assigns a priority to cached documents based
190       on the cost of a cache miss and the size of the document. Documents
191       with the lowest priority are removed first.</dd>
192     </dl>
193
194     <div class="example"><h3>Example</h3><p><code>
195       MCacheRemovalAlgorithm GDSF<br />
196       MCacheRemovalAlgorithm LRU
197     </code></p></div>
198
199 </div>
200 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
201 <div class="directive-section"><h2><a name="MCacheSize" id="MCacheSize">MCacheSize</a> <a name="mcachesize" id="mcachesize">Directive</a></h2>
202 <table class="directive">
203 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The maximum amount of memory used by the cache in
204 KBytes</td></tr>
205 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MCacheSize <var>KBytes</var></code></td></tr>
206 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MCacheSize 100</code></td></tr>
207 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
208 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
209 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mem_cache</td></tr>
210 </table>
211     <p>The <code class="directive">MCacheSize</code> directive sets the maximum
212     amount of memory to be used by the cache, in KBytes (1024-byte units).
213     If a new object needs to be inserted in the cache and the size of the
214     object is greater than the remaining memory, objects will be removed
215     until the new object can be cached. The object to be removed is
216     selected using the algorithm specified by <code class="directive"><a href="#mcacheremovalalgorithm">MCacheRemovalAlgorithm</a></code>.</p>
217
218     <div class="example"><h3>Example</h3><p><code>
219       MCacheSize 700000
220     </code></p></div>
221
222     <div class="note"><h3>Note</h3>
223       <p>The <code class="directive">MCacheSize</code> value must be greater than
224       the value specified by the <code class="directive"><a href="#mcachemaxobjectsize">MCacheMaxObjectSize</a></code> directive.</p>
225     </div>
226
227 </div>
228 </div>
229 <div class="bottomlang">
230 <p><span>Available Languages: </span><a href="../en/mod/mod_mem_cache.html" title="English">&nbsp;en&nbsp;</a> |
231 <a href="../ja/mod/mod_mem_cache.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
232 <a href="../ko/mod/mod_mem_cache.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
233 </div><div id="footer">
234 <p class="apache">Copyright 1995-2006 The Apache Software Foundation or its licensors, as applicable.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
235 <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>
236 </body></html>