]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_cache_socache.xml
xforms.
[apache] / docs / manual / mod / mod_cache_socache.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
5
6 <!--
7  Licensed to the Apache Software Foundation (ASF) under one or more
8  contributor license agreements.  See the NOTICE file distributed with
9  this work for additional information regarding copyright ownership.
10  The ASF licenses this file to You under the Apache License, Version 2.0
11  (the "License"); you may not use this file except in compliance with
12  the License.  You may obtain a copy of the License at
13
14      http://www.apache.org/licenses/LICENSE-2.0
15
16  Unless required by applicable law or agreed to in writing, software
17  distributed under the License is distributed on an "AS IS" BASIS,
18  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  See the License for the specific language governing permissions and
20  limitations under the License.
21 -->
22
23 <modulesynopsis metafile="mod_cache_socache.xml.meta">
24
25 <name>mod_cache_socache</name>
26 <description>Shared object cache (socache) based storage module for the
27 HTTP caching filter.</description>
28 <status>Extension</status>
29 <sourcefile>mod_cache_socache.c</sourcefile>
30 <identifier>cache_socache_module</identifier>
31
32 <summary>
33     <p><module>mod_cache_socache</module> implements a shared object cache
34     (socache) based storage manager for <module>mod_cache</module>.</p>
35
36     <p>The headers and bodies of cached responses are combined, and stored
37     underneath a single key in the shared object cache. A
38     <a href="../socache.html">number of implementations</a> of shared object
39     caches are available to choose from.</p>
40
41     <p>Multiple content negotiated responses can be stored concurrently,
42     however the caching of partial content is not yet supported by this
43     module.</p>
44
45     <highlight language="config">
46 # Turn on caching
47 CacheSocache shmcb
48 CacheSocacheMaxSize 102400
49 &lt;Location /foo&gt;
50     CacheEnable socache
51 &lt;/Location&gt;
52
53 # Fall back to the disk cache
54 CacheSocache shmcb
55 CacheSocacheMaxSize 102400
56 &lt;Location /foo&gt;
57     CacheEnable socache
58     CacheEnable disk
59 &lt;/Location&gt;
60     </highlight>
61
62     <note><title>Note:</title>
63       <p><module>mod_cache_socache</module> requires the services of
64       <module>mod_cache</module>, which must be loaded before
65       mod_cache_socache.</p>
66     </note>
67 </summary>
68 <seealso><module>mod_cache</module></seealso>
69 <seealso><module>mod_cache_disk</module></seealso>
70 <seealso><a href="../caching.html">Caching Guide</a></seealso>
71
72 <directivesynopsis>
73 <name>CacheSocache</name>
74 <description>The directory root under which cache files are
75 stored</description>
76 <syntax>CacheSocache <var>type[:args]</var></syntax>
77 <contextlist><context>server config</context><context>virtual host</context>
78 </contextlist>
79 <compatibility>Available in Apache 2.5 and later</compatibility>
80
81 <usage>
82     <p>The <directive>CacheSocache</directive> directive defines the name of
83     the shared object cache implementation to use, followed by optional
84     arguments for that implementation. A <a href="../socache.html">number of
85     implementations</a> of shared object caches are available to choose
86     from.</p>
87
88     <highlight language="config">
89       CacheSocache shmcb
90     </highlight>
91 </usage>
92 </directivesynopsis>
93
94 <directivesynopsis>
95 <name>CacheSocacheMaxTime</name>
96 <description>The maximum time (in seconds) for a document to be placed in the
97 cache</description>
98 <syntax>CacheSocacheMaxTime <var>seconds</var></syntax>
99 <default>CacheSocacheMaxTime 86400</default>
100 <contextlist><context>server config</context>
101   <context>virtual host</context>
102   <context>directory</context>
103   <context>.htaccess</context>
104 </contextlist>
105 <compatibility>Available in Apache 2.5 and later</compatibility>
106
107 <usage>
108     <p>The <directive>CacheSocacheMaxTime</directive> directive sets the
109     maximum freshness lifetime, in seconds, for a document to be stored in
110     the cache. This value overrides the freshness lifetime defined for the
111     document by the HTTP protocol.</p>
112
113     <highlight language="config">
114       CacheSocacheMaxTime 86400
115     </highlight>
116 </usage>
117 </directivesynopsis>
118
119 <directivesynopsis>
120 <name>CacheSocacheMinTime</name>
121 <description>The maximum time (in seconds) for a document to be placed in the
122 cache</description>
123 <syntax>CacheSocacheMinTime <var>seconds</var></syntax>
124 <default>CacheSocacheMinTime 600</default>
125 <contextlist><context>server config</context>
126   <context>virtual host</context>
127   <context>directory</context>
128   <context>.htaccess</context>
129 </contextlist>
130 <compatibility>Available in Apache 2.5 and later</compatibility>
131
132 <usage>
133     <p>The <directive>CacheSocacheMinTime</directive> directive sets the
134     amount of seconds beyond the freshness lifetime of the response that the
135     response should be cached for in the shared object cache. If a response is
136     only stored for its freshness lifetime, there will be no opportunity to
137     revalidate the response to make it fresh again.</p>
138
139     <highlight language="config">
140       CacheSocacheMinTime 600
141     </highlight>
142 </usage>
143 </directivesynopsis>
144
145 <directivesynopsis>
146 <name>CacheSocacheMaxSize</name>
147 <description>The maximum size (in bytes) of an entry to be placed in the
148 cache</description>
149 <syntax>CacheSocacheMaxSize <var>bytes</var></syntax>
150 <default>CacheSocacheMaxSize 102400</default>
151 <contextlist><context>server config</context>
152   <context>virtual host</context>
153   <context>directory</context>
154   <context>.htaccess</context>
155 </contextlist>
156 <compatibility>Available in Apache 2.5 and later</compatibility>
157
158 <usage>
159     <p>The <directive>CacheSocacheMaxSize</directive> directive sets the
160     maximum size, in bytes, for the combined headers and body of a document
161     to be considered for storage in the cache. The larger the headers that
162     are stored alongside the body, the smaller the body may be.</p>
163
164     <p>The <module>mod_cache_socache</module> module will only attempt to
165     cache responses that have an explicit content length, or that are small
166     enough to be written in one pass. This is done to allow the
167     <module>mod_cache_disk</module> module to have an opportunity to cache
168     responses larger than those cacheable within
169     <module>mod_cache_socache</module>.</p>
170
171     <highlight language="config">
172       CacheSocacheMaxSize 102400
173     </highlight>
174 </usage>
175 </directivesynopsis>
176
177 <directivesynopsis>
178 <name>CacheSocacheReadSize</name>
179 <description>The minimum size (in bytes) of the document to read and be cached
180   before sending the data downstream</description>
181 <syntax>CacheSocacheReadSize <var>bytes</var></syntax>
182 <default>CacheSocacheReadSize 0</default>
183 <contextlist><context>server config</context>
184     <context>virtual host</context>
185     <context>directory</context>
186     <context>.htaccess</context>
187 </contextlist>
188 <compatibility>Available in Apache 2.5 and later</compatibility>
189
190 <usage>
191     <p>The <directive>CacheSocacheReadSize</directive> 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     <highlight language="config">
203       CacheReadSize 102400
204     </highlight>
205 </usage>
206 </directivesynopsis>
207
208 <directivesynopsis>
209 <name>CacheSocacheReadTime</name>
210 <description>The minimum time (in milliseconds) that should elapse while reading
211   before data is sent downstream</description>
212 <syntax>CacheSocacheReadTime <var>milliseconds</var></syntax>
213 <default>CacheSocacheReadTime 0</default>
214 <contextlist><context>server config</context>
215   <context>virtual host</context>
216   <context>directory</context>
217   <context>.htaccess</context>
218 </contextlist>
219 <compatibility>Available in Apache 2.5 and later</compatibility>
220
221 <usage>
222     <p>The <directive>CacheSocacheReadTime</directive> directive sets the minimum amount
223     of elapsed time that should pass before making an attempt to send data
224     downstream to the client. During the time period, data will be buffered
225     before sending the result to the client. This can improve performance when
226     caching content from a reverse proxy.</p>
227
228     <p>The default of zero disables this option.</p>
229
230     <p>This directive only takes effect when the data is being saved to the
231     cache, as opposed to data being served from the cache. It is recommended
232     that this option be used alongside the
233     <directive module="mod_cache_socache">CacheSocacheReadSize</directive> directive
234     to ensure that the server does not buffer excessively should data arrive faster
235     than expected.</p>
236
237     <highlight language="config">
238       CacheSocacheReadTime 1000
239     </highlight>
240 </usage>
241 </directivesynopsis>
242
243 </modulesynopsis>