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_socache - 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" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" />
12<script src="/style/scripts/prettify.min.js" type="text/javascript">
13</script>
14
15<link href="/images/favicon.ico" rel="shortcut icon" /></head>
16<body>
17<div id="page-header">
18<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
19<p class="apache">Apache HTTP Server Version 2.4</p>
20<img alt="" src="/images/feather.gif" /></div>
21<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
22<div id="path">
23<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.4</a> &gt; <a href="./">Modules</a></div>
24<div id="page-content">
25<div id="preamble"><h1>Apache Module mod_cache_socache</h1>
26<div class="toplang">
27<p><span>Available Languages: </span><a href="/en/mod/mod_cache_socache.html" title="English">&nbsp;en&nbsp;</a> |
28<a href="/fr/mod/mod_cache_socache.html" hreflang="fr" rel="alternate" title="Fran�ais">&nbsp;fr&nbsp;</a></p>
29</div>
30<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Shared object cache (socache) based storage module for the
31HTTP caching filter.</td></tr>
32<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
33<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>cache_socache_module</td></tr>
34<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_cache_socache.c</td></tr></table>
35<h3>Summary</h3>
36
37    <p><code class="module"><a href="/mod/mod_cache_socache.html">mod_cache_socache</a></code> implements a shared object cache
38    (socache) based storage manager for <code class="module"><a href="/mod/mod_cache.html">mod_cache</a></code>.</p>
39
40    <p>The headers and bodies of cached responses are combined, and stored
41    underneath a single key in the shared object cache. A
42    <a href="/socache.html">number of implementations</a> of shared object
43    caches are available to choose from.</p>
44
45    <p>Multiple content negotiated responses can be stored concurrently,
46    however the caching of partial content is not yet supported by this
47    module.</p>
48
49    <pre class="prettyprint lang-config"># Turn on caching
50CacheSocache shmcb
51CacheSocacheMaxSize 102400
52&lt;Location /foo&gt;
53    CacheEnable socache
54&lt;/Location&gt;
55
56# Fall back to the disk cache
57CacheSocache shmcb
58CacheSocacheMaxSize 102400
59&lt;Location /foo&gt;
60    CacheEnable socache
61    CacheEnable disk
62&lt;/Location&gt;</pre>
63
64
65    <div class="note"><h3>Note:</h3>
66      <p><code class="module"><a href="/mod/mod_cache_socache.html">mod_cache_socache</a></code> requires the services of
67      <code class="module"><a href="/mod/mod_cache.html">mod_cache</a></code>, which must be loaded before
68      mod_cache_socache.</p>
69    </div>
70</div>
71<div id="quickview"><h3 class="directives">Directives</h3>
72<ul id="toc">
73<li><img alt="" src="/images/down.gif" /> <a href="#cachesocache">CacheSocache</a></li>
74<li><img alt="" src="/images/down.gif" /> <a href="#cachesocachemaxsize">CacheSocacheMaxSize</a></li>
75<li><img alt="" src="/images/down.gif" /> <a href="#cachesocachemaxtime">CacheSocacheMaxTime</a></li>
76<li><img alt="" src="/images/down.gif" /> <a href="#cachesocachemintime">CacheSocacheMinTime</a></li>
77<li><img alt="" src="/images/down.gif" /> <a href="#cachesocachereadsize">CacheSocacheReadSize</a></li>
78<li><img alt="" src="/images/down.gif" /> <a href="#cachesocachereadtime">CacheSocacheReadTime</a></li>
79</ul>
80<h3>See also</h3>
81<ul class="seealso">
82<li><code class="module"><a href="/mod/mod_cache.html">mod_cache</a></code></li>
83<li><code class="module"><a href="/mod/mod_cache_disk.html">mod_cache_disk</a></code></li>
84<li><a href="/caching.html">Caching Guide</a></li>
85</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
86
87<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
88<div class="directive-section"><h2><a name="CacheSocache" id="CacheSocache">CacheSocache</a> <a name="cachesocache" id="cachesocache">Directive</a></h2>
89<table class="directive">
90<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The directory root under which cache files are
91stored</td></tr>
92<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheSocache <var>type[:args]</var></code></td></tr>
93<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
94<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
95<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_cache_socache</td></tr>
96<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.4.5 and later</td></tr>
97</table>
98    <p>The <code class="directive">CacheSocache</code> directive defines the name of
99    the shared object cache implementation to use, followed by optional
100    arguments for that implementation. A <a href="/socache.html">number of
101    implementations</a> of shared object caches are available to choose
102    from.</p>
103
104    <pre class="prettyprint lang-config">CacheSocache shmcb</pre>
105
106
107</div>
108<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
109<div class="directive-section"><h2><a name="CacheSocacheMaxSize" id="CacheSocacheMaxSize">CacheSocacheMaxSize</a> <a name="cachesocachemaxsize" id="cachesocachemaxsize">Directive</a></h2>
110<table class="directive">
111<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The maximum size (in bytes) of an entry to be placed in the
112cache</td></tr>
113<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheSocacheMaxSize <var>bytes</var></code></td></tr>
114<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CacheSocacheMaxSize 102400</code></td></tr>
115<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
116<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
117<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_cache_socache</td></tr>
118<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.4.5 and later</td></tr>
119</table>
120    <p>The <code class="directive">CacheSocacheMaxSize</code> directive sets the
121    maximum size, in bytes, for the combined headers and body of a document
122    to be considered for storage in the cache. The larger the headers that
123    are stored alongside the body, the smaller the body may be.</p>
124
125    <p>The <code class="module"><a href="/mod/mod_cache_socache.html">mod_cache_socache</a></code> module will only attempt to
126    cache responses that have an explicit content length, or that are small
127    enough to be written in one pass. This is done to allow the
128    <code class="module"><a href="/mod/mod_cache_disk.html">mod_cache_disk</a></code> module to have an opportunity to cache
129    responses larger than those cacheable within
130    <code class="module"><a href="/mod/mod_cache_socache.html">mod_cache_socache</a></code>.</p>
131
132    <pre class="prettyprint lang-config">CacheSocacheMaxSize 102400</pre>
133
134
135</div>
136<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
137<div class="directive-section"><h2><a name="CacheSocacheMaxTime" id="CacheSocacheMaxTime">CacheSocacheMaxTime</a> <a name="cachesocachemaxtime" id="cachesocachemaxtime">Directive</a></h2>
138<table class="directive">
139<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The maximum time (in seconds) for a document to be placed in the
140cache</td></tr>
141<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheSocacheMaxTime <var>seconds</var></code></td></tr>
142<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CacheSocacheMaxTime 86400</code></td></tr>
143<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
144<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
145<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_cache_socache</td></tr>
146<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.4.5 and later</td></tr>
147</table>
148    <p>The <code class="directive">CacheSocacheMaxTime</code> directive sets the
149    maximum freshness lifetime, in seconds, for a document to be stored in
150    the cache. This value overrides the freshness lifetime defined for the
151    document by the HTTP protocol.</p>
152
153    <pre class="prettyprint lang-config">CacheSocacheMaxTime 86400</pre>
154
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="CacheSocacheMinTime" id="CacheSocacheMinTime">CacheSocacheMinTime</a> <a name="cachesocachemintime" id="cachesocachemintime">Directive</a></h2>
159<table class="directive">
160<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The maximum time (in seconds) for a document to be placed in the
161cache</td></tr>
162<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheSocacheMinTime <var>seconds</var></code></td></tr>
163<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CacheSocacheMinTime 600</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_socache</td></tr>
167<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.5 and later</td></tr>
168</table>
169    <p>The <code class="directive">CacheSocacheMinTime</code> directive sets the
170    amount of seconds beyond the freshness lifetime of the response that the
171    response should be cached for in the shared object cache. If a response is
172    only stored for its freshness lifetime, there will be no opportunity to
173    revalidate the response to make it fresh again.</p>
174
175    <pre class="prettyprint lang-config">CacheSocacheMinTime 600</pre>
176
177
178</div>
179<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
180<div class="directive-section"><h2><a name="CacheSocacheReadSize" id="CacheSocacheReadSize">CacheSocacheReadSize</a> <a name="cachesocachereadsize" id="cachesocachereadsize">Directive</a></h2>
181<table class="directive">
182<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
183  before sending the data downstream</td></tr>
184<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheSocacheReadSize <var>bytes</var></code></td></tr>
185<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CacheSocacheReadSize 0</code></td></tr>
186<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
187<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
188<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_cache_socache</td></tr>
189<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.4.5 and later</td></tr>
190</table>
191    <p>The <code class="directive">CacheSocacheReadSize</code> directive sets the
192    minimum amount of data, in bytes, to be read from the backend before the
193    data is sent to the client. The default of zero causes all data read of
194    any size to be passed downstream to the client immediately as it arrives.
195    Setting this to a higher value causes the disk cache to buffer at least
196    this amount before sending the result to the client. This can improve
197    performance when caching content from a slow reverse proxy.</p>
198
199    <p>This directive only takes effect when the data is being saved to the
200    cache, as opposed to data being served from the cache.</p>
201
202    <pre class="prettyprint lang-config">CacheReadSize 102400</pre>
203
204
205</div>
206<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
207<div class="directive-section"><h2><a name="CacheSocacheReadTime" id="CacheSocacheReadTime">CacheSocacheReadTime</a> <a name="cachesocachereadtime" id="cachesocachereadtime">Directive</a></h2>
208<table class="directive">
209<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The minimum time (in milliseconds) that should elapse while reading
210  before data is sent downstream</td></tr>
211<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheSocacheReadTime <var>milliseconds</var></code></td></tr>
212<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CacheSocacheReadTime 0</code></td></tr>
213<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
214<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
215<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_cache_socache</td></tr>
216<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.4.5 and later</td></tr>
217</table>
218    <p>The <code class="directive">CacheSocacheReadTime</code> directive sets the minimum amount
219    of elapsed time that should pass before making an attempt to send data
220    downstream to the client. During the time period, data will be buffered
221    before sending the result to the client. This can improve performance when
222    caching content from a reverse proxy.</p>
223
224    <p>The default of zero disables this option.</p>
225
226    <p>This directive only takes effect when the data is being saved to the
227    cache, as opposed to data being served from the cache. It is recommended
228    that this option be used alongside the
229    <code class="directive"><a href="#cachesocachereadsize">CacheSocacheReadSize</a></code> directive
230    to ensure that the server does not buffer excessively should data arrive faster
231    than expected.</p>
232
233    <pre class="prettyprint lang-config">CacheSocacheReadTime 1000</pre>
234
235
236</div>
237</div>
238<div class="bottomlang">
239<p><span>Available Languages: </span><a href="/en/mod/mod_cache_socache.html" title="English">&nbsp;en&nbsp;</a> |
240<a href="/fr/mod/mod_cache_socache.html" hreflang="fr" rel="alternate" title="Fran�ais">&nbsp;fr&nbsp;</a></p>
241</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
242<script type="text/javascript"><!--//--><![CDATA[//><!--
243var comments_shortname = 'httpd';
244var comments_identifier = 'http://httpd.apache.org/docs/2.4/mod/mod_cache_socache.html';
245(function(w, d) {
246    if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
247        d.write('<div id="comments_thread"><\/div>');
248        var s = d.createElement('script');
249        s.type = 'text/javascript';
250        s.async = true;
251        s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
252        (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
253    }
254    else { 
255        d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
256    }
257})(window, document);
258//--><!]]></script></div><div id="footer">
259<p class="apache">Copyright 2014 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>
260<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
261if (typeof(prettyPrint) !== 'undefined') {
262    prettyPrint();
263}
264//--><!]]></script>
265</body></html>