1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.ja.xsl"?>
4 <!-- English Revision: 504183:1037244 (outdated) -->
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
14 http://www.apache.org/licenses/LICENSE-2.0
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.
23 <modulesynopsis metafile="mod_cache.xml.meta">
25 <name>mod_cache</name>
26 <description>URI をキーにしたコンテンツのキャッシュ</description>
27 <status>Extension</status>
28 <sourcefile>mod_cache.c</sourcefile>
29 <identifier>cache_module</identifier>
32 <note type="warning">このモジュールは <directive
33 module="mod_authz_host">Allow</directive> や <directive
34 module="mod_authz_host">Deny</directive> ディレクティブを無視しますので、
35 注意して使って下さい。クライアントのホスト名、アドレスや環境変数を使って
36 アクセスを制限したいコンテンツに対してはキャッシュ機能を有効にするべきではありません。
39 <p><module>mod_cache</module> はローカルのコンテンツやプロキシされた
40 コンテンツをキャッシュするために使われる <a
41 href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a> 準拠の
42 HTTP コンテンツキャッシュを実装しています。<module>mod_cache</module>
43 の動作にはストレージを管理するモジュールが必要です。標準
44 Apache 配布には二つストレージ管理モジュールが含まれています:</p>
47 <dt><module>mod_cache_disk</module></dt>
48 <dd>ディスクを使用したストレージ管理機構を実装しています。</dd>
50 <dt><module>mod_mem_cache</module></dt>
51 <dd>メモリを使用したストレージ管理機構を実装しています。
52 <module>mod_mem_cache</module> は次の二つのモードのどちらかで動作する
53 ように設定できます: オープンされているファイル記述子をキャッシュするモードか、
54 ヒープ上でのオブジェクトの自体をキャッシュをするモードです。
55 <module>mod_mem_cache</module> はローカルで生成されるコンテンツや、
56 <module>mod_proxy</module> が
57 <directive module="mod_proxy">ProxyPass</directive> を使って設定されている
58 ときの (つまり<dfn>リバースプロキシ</dfn> での) バックエンドサーバの
59 コンテンツをキャッシュするのに使えます。</dd>
62 <p>コンテンツのキャッシュへの保存と取得は URI に基づいたキーが使われます。
63 アクセス保護のかけられているコンテンツはキャッシュされません。</p>
64 <p>より詳細な解説や例については<a href="../caching.html">キャッシュ機能</a>
67 <seealso><a href="../caching.html">キャッシュ機能</a></seealso>
69 <section id="related"><title>関連モジュールとディレクティブ</title>
72 <module>mod_cache_disk</module>
73 <module>mod_mem_cache</module>
76 <directive module="mod_cache_disk">CacheRoot</directive>
77 <directive module="mod_cache_disk">CacheDirLevels</directive>
78 <directive module="mod_cache_disk">CacheDirLength</directive>
79 <directive module="mod_cache_disk">CacheMinFileSize</directive>
80 <directive module="mod_cache_dist">CacheMaxFileSize</directive>
81 <directive module="mod_mem_cache">MCacheSize</directive>
82 <directive module="mod_mem_cache">MCacheMaxObjectCount</directive>
83 <directive module="mod_mem_cache">MCacheMinObjectSize</directive>
84 <directive module="mod_mem_cache">MCacheMaxObjectSize</directive>
85 <directive module="mod_mem_cache">MCacheRemovalAlgorithm</directive>
86 <directive module="mod_mem_cache">MCacheMaxStreamingBuffer</directive>
91 <section id="sampleconf"><title>サンプル設定</title>
92 <example><title>Sample httpd.conf</title>
94 # Sample Cache Configuration<br />
96 LoadModule cache_module modules/mod_cache.so<br />
98 <IfModule mod_cache.c><br />
100 #LoadModule cache_disk_module modules/mod_cache_disk.so<br />
101 # If you want to use mod_cache_disk instead of mod_mem_cache,<br />
102 # uncomment the line above and comment out the LoadModule line below.<br />
103 <IfModule mod_cache_disk.c><br />
105 CacheRoot c:/cacheroot<br />
106 CacheEnable disk /<br />
107 CacheDirLevels 5<br />
108 CacheDirLength 3<br />
110 </IfModule> <br />
112 LoadModule mem_cache_module modules/mod_mem_cache.so<br />
113 <IfModule mod_mem_cache.c><br />
115 CacheEnable mem /<br />
116 MCacheSize 4096<br />
117 MCacheMaxObjectCount 100<br />
118 MCacheMinObjectSize 1<br />
119 MCacheMaxObjectSize 2048<br />
121 </IfModule><br />
123 # When acting as a proxy, don't cache the list of security updates<br />
124 CacheDisable http://security.update.server/update-list/<br />
131 <name>CacheEnable</name>
132 <description>指定したストレージ管理方式を使ってのキャッシュを有効にする</description>
133 <syntax>CacheEnable <var>cache_type</var> <var>url-string</var></syntax>
134 <contextlist><context>server config</context><context>virtual host</context>
138 <p><directive>CacheEnable</directive> ディレクティブで <module>mod_cache</module>
139 モジュールが <var>url-string</var> 以下の URL をキャッシュするようにします。
140 キャッシュストレージ管理方式は <var>cache_type</var> 引数で指定します。
141 <var>cache_type</var> <code> mem</code> で、
142 <module>mod_mem_cache</module> で実装されているメモリを使ったストレージ
143 管理方式を使うように <module>mod_cache</module> に指示します。
144 <var>cache_type</var> <code>disk</code> で、
145 <module>mod_cache_disk</module> で実装されているディスクを使ったストレージ
146 管理を使うように <module>mod_cache</module> に指示します。
147 <var>cache_type</var> <code>fd</code> は <module>mod_cache</module> に
148 <module>mod_mem_cache</module> により実装されているファイル記述子の
149 キャッシュを使うように指示します。</p>
151 <p>(下の例のように) <directive>CacheEnable</directive> ディレクティブの
152 URL 空間が重複しているときは、該当するストレージ方式を順に試して、
153 実際にリクエストの処理ができると、その方式で処理します。
154 ストレージ管理方式が実行される順番は設定ファイル中の
155 <directive>CacheEnable</directive> の順番により決定されます。</p>
158 CacheEnable mem /manual<br />
159 CacheEnable fd /images<br />
160 CacheEnable disk /<br />
163 <p>フォワードプロクシサーバとして動作する場合、
164 <var>url-string</var> を使って、キャッシュを有効にするリモートサイトや
165 プロクシプロトコルを指定することもできます。</p>
168 # Cache proxied url's<br />
169 CacheEnable disk /<br /><br />
170 # Cache FTP-proxied url's<br />
171 CacheEnable disk ftp://<br /><br />
172 # Cache content from www.apache.org<br />
173 CacheEnable disk http://www.apache.org/<br />
180 <name>CacheHeader</name>
181 <description>Add an X-Cache header to the response.</description>
182 <contextlist><context>server config</context><context>virtual host</context><context>directory</context><context>.htaccess</context></contextlist>
183 <usage><p>Documentation not yet translated. Please see English version of document.</p></usage>
187 <name>CacheDisable</name>
188 <description>特定の URL をキャッシュしない</description>
189 <syntax>CacheDisable <var> url-string</var></syntax>
190 <contextlist><context>server config</context><context>virtual host</context>
194 <p><directive>CacheDisable</directive> ディレクティブで
195 <module>mod_cache</module> モジュールが <var>url-string</var> 以下の
196 URL をキャッシュ<em>しない</em>ようにします。</p>
198 <example><title>例</title>
199 CacheDisable /local_files
205 <name>CacheMaxExpire</name>
206 <description>ドキュメントをキャッシュする最大時間を秒数で表したもの</description>
207 <syntax>CacheMaxExpire <var>seconds</var></syntax>
208 <default>CacheMaxExpire 86400 (一日)</default>
209 <contextlist><context>server config</context><context>virtual host</context>
213 <p><directive>CacheMaxExpire</directive> ディレクティブは、
214 キャッシュする HTTP ドキュメントを、元のサーバに問い合わせないまま最大何秒
215 保持してもよいかを指定します。つまり、ドキュメントは最大でこの秒数間ぶん古く
216 なることになります。この最大値は、<transnote>レスポンス中で</transnote>ドキュメントと共に
217 ドキュメントの期日が提供されている場合でも適用されます。</p>
220 CacheMaxExpire 604800
226 <name>CacheMinExpire</name>
227 <description>ドキュメントをキャッシュする最小秒数</description>
228 <syntax>CacheMinExpire <var>seconds</var></syntax>
229 <default>CacheMinExpire 0</default>
230 <contextlist><context>server config</context><context>virtual host</context>
234 <p>キャッシュ可能な HTTP ドキュメントがあったときに、オリジンサーバに問い合わせることなく
235 保持する秒数の最小値は <directive>CacheMinExpire</directive> ディレクティブを使って設定します。
236 この値は、ドキュメントに妥当な有効期限が指定されていなかった場合にのみ使われます。</p>
246 <name>CacheQuickHandler</name>
247 <description>Run the cache from the quick handler.</description>
248 <contextlist><context>server config</context><context>virtual host</context></contextlist>
249 <usage><p>Documentation not yet translated. Please see English version of document.</p></usage>
253 <name>CacheStaleOnError</name>
254 <description>Serve stale content in place of 5xx responses.</description>
255 <contextlist><context>server config</context><context>virtual host</context><context>directory</context><context>.htaccess</context></contextlist>
256 <usage><p>Documentation not yet translated. Please see English version of document.</p></usage>
260 <name>CacheStoreExpired</name>
261 <description>Attempt to cache responses that the server reports as expired</description>
262 <contextlist><context>server config</context><context>virtual host</context><context>directory</context><context>.htaccess</context></contextlist>
263 <usage><p>Documentation not yet translated. Please see English version of document.</p></usage>
267 <name>CacheDefaultExpire</name>
268 <description>期日が指定されていないときにドキュメントをキャッシュするデフォルトの期間</description>
269 <syntax>CacheDefaultExpire <var>seconds</var></syntax>
270 <default>CacheDefaultExpire 3600 (1時間)</default>
271 <contextlist><context>server config</context><context>virtual host</context>
275 <p><directive>CacheDefaultExpire</directive> ディレクティブは、ドキュメントに
276 有効期限 (expiry) や最終修正時刻 (last-modified) が指定されていない場合の
277 デフォルトの時間を指定します。<directive>CacheMaxExpire</directive>
278 ディレクティブで指定された値はこの設定を上書き<em>しません</em>。</p>
281 CacheDefaultExpire 86400
287 <name>CacheDetailHeader</name>
288 <description>Add an X-Cache-Detail header to the response.</description>
289 <contextlist><context>server config</context><context>virtual host</context><context>directory</context><context>.htaccess</context></contextlist>
290 <usage><p>Documentation not yet translated. Please see English version of document.</p></usage>
294 <name>CacheIgnoreNoLastMod</name>
295 <description>応答に Last Modified が無くても気にしないようにする</description>
296 <syntax>CacheIgnoreNoLastMod On|Off</syntax>
297 <default>CacheIgnoreNoLastMod Off</default>
298 <contextlist><context>server config</context><context>virtual host</context>
302 <p>通常、Last-Modified による最終修正時刻の無いドキュメントはキャッシュ
303 されません。(例えば <module>mod_include</module> による処理のときなどに)
304 Last-Modified 時刻が消去されたり、そもそも最初から提供されていない
305 状況があります。<directive>CacheIgnoreNoLastMod</directive>
306 ディレクティブを使うと、Last-Modified 日時が指定されていない
307 ドキュメントでもキャッシュするように指定できます。ドキュメントに
308 最終修正時刻 (Last-Modified) 有効期限 (expiry) がない場合は、有効期限の
309 生成に <directive>CacheDefaultExpire</directive> が使われます。</p>
312 CacheIgnoreNoLastMod On
318 <name>CacheIgnoreCacheControl</name>
319 <description>キャッシュされているコンテンツを返さないようにクライアントから
320 リクエストされても無視する</description>
321 <syntax>CacheIgnoreCacheControl On|Off</syntax>
322 <default>CacheIgnoreCacheControl Off</default>
323 <contextlist><context>server config</context><context>virtual host</context>
327 <p>Cache-Control: no-cache ヘッダや Pragma: no-store ヘッダのあるリクエストに
328 対しては、通常キャッシュを使いません。<directive>CacheIgnoreCacheControl</directive>
329 ディレクティブを使うと、この動作を上書きできます。
330 <directive>CacheIgnoreCacheControl</directive> On とすると、
331 リクエストに no-cache という値があっても、キャッシュを使ってドキュメントを
332 返すようになります。認証を必要とするドキュメントは<em>決して</em>
336 CacheIgnoreCacheControl On
339 <note type="warning"><title>警告</title>
340 このディレクティブを使うと、ドキュメント取得時にキャッシュを使わないように
341 クライアントがリクエストしているにもかかわらず、キャッシュを
343 古いコンテンツが送られ続けることになってしまうかもしれません。
346 <seealso><directive module="mod_cache">CacheStorePrivate</directive></seealso>
347 <seealso><directive module="mod_cache">CacheStoreNoStore</directive></seealso>
351 <name>CacheIgnoreQueryString</name>
352 <description>キャッシュ時にクエリーストリングを無視する</description>
353 <syntax>CacheIgnoreQueryString On|Off</syntax>
354 <default>CacheIgnoreQueryString Off</default>
355 <contextlist><context>server config</context><context>virtual host</context>
359 <p>クエリーストリング付のリクエストについては通常、クエリーストリングごとに
361 キャッシュされるのは有効期限が指定されている場合のみで、これは
362 RFC 2616/13.9 に従ったものです。
363 <directive>CacheIgnoreQueryString</directive> ディレクティブを使うと
364 有効期限が指定されていなくてもキャッシュしますし、
365 クエリーストリングが異なっていてもキャッシュを返します。
366 このディレクティブが有効になっている場合、キャッシュ機能の側面からみると、
367 あたかもリクエストにクエリーストリングがついていなかったかのように扱います。</p>
370 CacheIgnoreQueryString On
377 <name>CacheIgnoreURLSessionIdentifiers</name>
378 <description>Ignore defined session identifiers encoded in the URL when caching </description>
379 <contextlist><context>server config</context><context>virtual host</context></contextlist>
380 <usage><p>Documentation not yet translated. Please see English version of document.</p></usage>
384 <name>CacheKeyBaseURL</name>
385 <description>Override the base URL of reverse proxied cache keys.</description>
386 <contextlist><context>server config</context><context>virtual host</context></contextlist>
387 <usage><p>Documentation not yet translated. Please see English version of document.</p></usage>
391 <name>CacheLastModifiedFactor</name>
392 <description>LastModified の日付に基づいて有効期限 (expiry)
395 <syntax>CacheLastModifiedFactor <var>float</var></syntax>
396 <default>CacheLastModifiedFactor 0.1</default>
397 <contextlist><context>server config</context><context>virtual host</context>
401 <p>ドキュメントに Last-Modified の日付が無いけれども有効期限 (expiry)
402 の日付があるというときに、有効期限を最終修正時刻からの経過時間として
403 計算するようにできます。有効期限を次の計算式に従って生成するのですが、
404 そのときに使われる <var>factor</var> を
405 <directive>CacheLastModifiedFactor</directive> ディレクティブで指定します。
408 <p><code>expiry-period = time-since-last-modified-date * <var>factor</var>
409 expiry-date = current-date + expiry-period</code></p>
411 <p>例えば、ドキュメントが 10 時間前に最後に修正されていて、
412 <var>factor</var> が 0.1 であれば、期日は 10*0.1 = 1 時間に
413 設定されます。現在時刻が 3:00pm であれば、計算された期日は
414 3:00pm + 1hour = 4:00pm になります。</p>
416 <p>期日が <directive>CacheMaxExpire</directive> で設定されている値
417 より大きくなってしまっている場合は、<directive>CacheMaxExpire</directive>
421 CacheLastModifiedFactor 0.5
427 <name>CacheLock</name>
428 <description>Enable the thundering herd lock.</description>
429 <contextlist><context>server config</context><context>virtual host</context></contextlist>
430 <usage><p>Documentation not yet translated. Please see English version of document.</p></usage>
434 <name>CacheLockMaxAge</name>
435 <description>Set the maximum possible age of a cache lock.</description>
436 <contextlist><context>server config</context><context>virtual host</context></contextlist>
437 <usage><p>Documentation not yet translated. Please see English version of document.</p></usage>
441 <name>CacheLockPath</name>
442 <description>Set the lock path directory.</description>
443 <contextlist><context>server config</context><context>virtual host</context></contextlist>
444 <usage><p>Documentation not yet translated. Please see English version of document.</p></usage>
448 <name>CacheIgnoreHeaders</name>
449 <description>指定された HTTP ヘッダをキャッシュに保存しない。
451 <syntax>CacheIgnoreHeaders <var>header-string</var> [<var>header-string</var>] ...</syntax>
452 <default>CacheIgnoreHeaders None</default>
453 <contextlist><context>server config</context><context>virtual host</context>
457 <p>RFC 2616 によると、hop-by-hop HTTP ヘッダはキャッシュには保管されません。
458 以下のヘッダは hop-by-hop ヘッダに該当しますので、
459 <directive>CacheIgnoreHeaders</directive>
460 の設定に<em>関係なく</em>キャッシュには保管されません:</p>
462 <li><code>Connection</code></li>
463 <li><code>Keep-Alive</code></li>
464 <li><code>Proxy-Authenticate</code></li>
465 <li><code>Proxy-Authorization</code></li>
466 <li><code>TE</code></li>
467 <li><code>Trailers</code></li>
468 <li><code>Transfer-Encoding</code></li>
469 <li><code>Upgrade</code></li>
472 <p><directive>CacheIgnoreHeaders</directive> で
473 キャッシュに保管しない追加の HTTP ヘッダを指定します。
474 例えば、クッキーをキャッシュに保管しないようにした方がよい場合も
477 <p><directive>CacheIgnoreHeaders</directive> の引数は、
478 キャッシュに保管しない HTTP ヘッダを空白区切りにしたリスト形式です。
479 キャッシュに保管しないヘッダが hop-by-hop ヘッダだけの場合
480 (RFC 2616 準拠の動作のとき) は、
481 <directive>CacheIgnoreHeaders</directive> を <code>None</code>
484 <example><title>例 1</title>
485 CacheIgnoreHeaders Set-Cookie
488 <example><title>例 2</title>
489 CacheIgnoreHeaders None
492 <note type="warning"><title>警告:</title>
493 <code>Expires</code> のような適切のキャッシュ管理のために必要な
494 ヘッダが <directive>CacheIgnoreHeaders</directive> の設定により
495 保管されていないときは、mod_cache の動作は定義されていません。
501 <name>CacheStorePrivate</name>
502 <description>private と指定されているレスポンスのキャッシュを試みる。</description>
503 <syntax>CacheStorePrivate On|Off</syntax>
504 <default>CacheStorePrivate Off</default>
505 <contextlist><context>server config</context><context>virtual host</context>
509 <p>通常 Cache-Control: private ヘッダのついているレスポンスは
510 キャッシュされません。<directive>CacheStorePrivate</directive>
511 ディレクティブでこの挙動を上書きできます。
512 <directive>CacheStorePrivate</directive> On で private ヘッダのついている
513 リソースに対してもキャッシュを試みるようになります。
514 ただし認証の求められるリソースは <em>決して</em> キャッシュされません。</p>
520 <note type="warning"><title>警告:</title>
521 上流サーバがキャッシュしないように指定してきても、
522 それを無視してキャッシュするようになります。
523 望ましい挙動になるのは、本当に 'private' なキャッシュについてのみでしょう。
526 <seealso><directive module="mod_cache">CacheIgnoreCacheControl</directive></seealso>
527 <seealso><directive module="mod_cache">CacheStoreNoStore</directive></seealso>
531 <name>CacheStoreNoStore</name>
532 <description>no-store と指定されているレスポンスのキャッシュを試みる。</description>
533 <syntax>CacheStoreNoStore On|Off</syntax>
534 <default>CacheStoreNoStore Off</default>
535 <contextlist><context>server config</context><context>virtual host</context>
539 <p>通常 Cache-Control: no-store ヘッダのついているレスポンスは
540 キャッシュされません。<directive>CacheStoreNoCache</directive>
541 ディレクティブでこの挙動を上書きできます。
542 <directive>CacheStoreNoCache</directive> On で no-store ヘッダのついている
543 リソースに対してもキャッシュを試みるようになります。
544 ただし認証の求められるリソースは <em>決して</em> キャッシュされません。</p>
550 <note type="warning"><title>警告:</title>
551 RFC 2616 に記載されているように no-store ディレクティブは、
552 "不注意による機密情報の漏洩や残留 (バックアップテープ等) を防ぐ"
553 目的で使われますが、このオプションを有効にすると、
554 機密情報を保持することになってしまいます。
558 <seealso><directive module="mod_cache">CacheIgnoreCacheControl</directive></seealso>
559 <seealso><directive module="mod_cache">CacheStorePrivate</directive></seealso>