842ae4bd224140319ae7feec1872b93dfd491143fielding<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
842ae4bd224140319ae7feec1872b93dfd491143fielding<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
842ae4bd224140319ae7feec1872b93dfd491143fielding<!-- $LastChangedRevision$ -->
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding Licensed to the Apache Software Foundation (ASF) under one or more
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd contributor license agreements. See the NOTICE file distributed with
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding this work for additional information regarding copyright ownership.
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd The ASF licenses this file to You under the Apache License, Version 2.0
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd (the "License"); you may not use this file except in compliance with
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd the License. You may obtain a copy of the License at
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding Unless required by applicable law or agreed to in writing, software
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding distributed under the License is distributed on an "AS IS" BASIS,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding See the License for the specific language governing permissions and
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding limitations under the License.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding<description>Disk based storage module for the HTTP caching filter.</description>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding <p><module>mod_cache_disk</module> implements a disk based storage
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding <p>The headers and bodies of cached responses are stored separately on
22a7cd38c192adb811c7ab9bcba7b9261bf1c9edchrisd disk, in a directory structure derived from the md5 hash of the cached
22a7cd38c192adb811c7ab9bcba7b9261bf1c9edchrisd <p>Multiple content negotiated responses can be stored concurrently,
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding however the caching of partial content is not yet supported by this
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding module.</p>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding <p>Atomic cache updates to both header and body files are achieved
ba4c566c200c2436dae841b7c811807c80cd712afielding without the need for locking by storing the device and inode numbers of
ba4c566c200c2436dae841b7c811807c80cd712afielding the body file within the header file. This has the side effect that
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding cache entries manually moved into the cache will be ignored.</p>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding <p>The <program>htcacheclean</program> tool is provided to list cached
e8f95a682820a599fe41b22977010636be5c2717jim URLs, remove cached URLs, or to maintain the size of the disk cache
e8f95a682820a599fe41b22977010636be5c2717jim within size and/or inode limits. The tool can be run on demand, or
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding can be daemonized to offer continuous monitoring of directory sizes.</p>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding <p><module>mod_cache_disk</module> requires the services of
ba4c566c200c2436dae841b7c811807c80cd712afielding loaded before mod_cache_disk.</p>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding <p><module>mod_cache_disk</module> uses the sendfile feature to
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding serve files from the cache when supported by the platform, and
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding when enabled with <directive module="core">EnableSendfile</directive>.
ba4c566c200c2436dae841b7c811807c80cd712afielding However, per-directory and .htaccess configuration of
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding <directive module="core">EnableSendfile</directive> are ignored by
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding <module>mod_cache_disk</module> as the corresponding settings are not
ba4c566c200c2436dae841b7c811807c80cd712afielding available to the module when a request is being served from the
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard<seealso><module>mod_cache_socache</module></seealso>
0d496deee49b66bb43883640fa9c1a7e884a1b8ctrawick<seealso><a href="/caching.html">Caching Guide</a></seealso>
024cd9589e52cf11ce765dfddb5b5f0c6e421a48gstein<directivesynopsis>
024cd9589e52cf11ce765dfddb5b5f0c6e421a48gstein<description>The directory root under which cache files are
024cd9589e52cf11ce765dfddb5b5f0c6e421a48gsteinstored</description>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding<contextlist><context>server config</context><context>virtual host</context>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding</contextlist>
ea92d0ffcb30b186010a2c8ca2c80d2ac09e34dastoddard <p>The <directive>CacheRoot</directive> directive defines the name of
7c4aca408b6678f99033503e588bbc2fdb836b09stoddard the directory on the disk to contain cache files. If the <module
87e0bf269cc3386ee8e6ab561ff00770151f4f53niq >mod_cache_disk</module> module has been loaded or compiled in to the
5fac45c1ef49924141fe28497deb350cf031b377trawick Apache server, this directive <em>must</em> be defined. Failing to
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton provide a value for <directive>CacheRoot</directive> will result in
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton a configuration file processing error. The <directive
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard module="mod_cache_disk">CacheDirLevels</directive> and <directive
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard module="mod_cache_disk">CacheDirLength</directive> directives define
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard the structure of the directories under the specified root directory.</p>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding CacheRoot c:/cacheroot
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding </highlight>
3bc407b46a67691f3e5fd4f5f5ead4e1eff09998stoddard</directivesynopsis>
64dbb5532fba398c5e81efeb21c7fd50c05819d7niq<directivesynopsis>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding<description>The number of levels of subdirectories in the
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingcache.</description>
08eb8303a91265264085e646f5937c76ae1e0c5bnd<contextlist><context>server config</context><context>virtual host</context>
08eb8303a91265264085e646f5937c76ae1e0c5bnd</contextlist>
ea92d0ffcb30b186010a2c8ca2c80d2ac09e34dastoddard <p>The <directive>CacheDirLevels</directive> directive sets the number
3b60bc6cafbb662cb3edc70c1df81c8deb31175ajorton of subdirectory levels in the cache. Cached data will be saved this
3b60bc6cafbb662cb3edc70c1df81c8deb31175ajorton many directory levels below the <directive module="mod_cache_disk"
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard <p>A high value for <directive>CacheDirLevels</directive> combined
e8f95a682820a599fe41b22977010636be5c2717jim with a low value for <directive>CacheDirLength</directive> will result in
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard a relatively deep hierarchy, with a small number of subdirectories at each
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard <p>The result of <directive>CacheDirLevels</directive>*
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard <directive module="mod_cache_disk">CacheDirLength</directive> must
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard not be higher than 20.</p>
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard</directivesynopsis>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding<directivesynopsis>
08eb8303a91265264085e646f5937c76ae1e0c5bnd<description>The number of characters in subdirectory names</description>
fd709745f1226d683c57ad9bbcdd05971d214d0cstoddard<contextlist><context>server config</context><context>virtual host</context>
13c7ff50f27aefa2594d33089fcff6ceb9796fe7niq</contextlist>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding <p>The <directive>CacheDirLength</directive> directive sets the number
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard of characters for each subdirectory name in the cache hierarchy. It can
3bc407b46a67691f3e5fd4f5f5ead4e1eff09998stoddard be used in conjunction with <directive>CacheDirLevels</directive> to
3bc407b46a67691f3e5fd4f5f5ead4e1eff09998stoddard determine the approximate structure of your cache hierarchy.</p>
3bc407b46a67691f3e5fd4f5f5ead4e1eff09998stoddard <p>A high value for <directive>CacheDirLength</directive> combined
3bc407b46a67691f3e5fd4f5f5ead4e1eff09998stoddard with a low value for <directive>CacheDirLevels</directive> will result in
3bc407b46a67691f3e5fd4f5f5ead4e1eff09998stoddard a relatively flat hierarchy, with a large number of subdirectories at each
6951fc02abfd7642e45333902c14855836717fadrpluem >CacheDirLevels</directive>* <directive>CacheDirLength</directive>
6951fc02abfd7642e45333902c14855836717fadrpluem must not be higher than 20.</p>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding</directivesynopsis>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding<directivesynopsis>
ea92d0ffcb30b186010a2c8ca2c80d2ac09e34dastoddard<description>The minimum size (in bytes) of a document to be placed in the
71f3601de4983bc2a6aaffcf37dc1d35c8674a34coarcache</description>
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton</contextlist>
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard <p>The <directive>CacheMinFileSize</directive> directive sets the
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard minimum size, in bytes, for a document to be considered for storage
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard in the cache.</p>
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard CacheMinFileSize 64
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard </highlight>
e8f95a682820a599fe41b22977010636be5c2717jim</directivesynopsis>
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard<directivesynopsis>
0329db7881b698897213e816552b0ab31f8d4d56trawick<description>The maximum size (in bytes) of a document to be placed in the
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddardcache</description>
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton</contextlist>
e8f95a682820a599fe41b22977010636be5c2717jim <p>The <directive>CacheMaxFileSize</directive> directive sets the
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton maximum size, in bytes, for a document to be considered for storage in
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton the cache.</p>
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton CacheMaxFileSize 64000
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton </highlight>
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton</directivesynopsis>
ed4b039edaff2a734bd8da9c33e43e2fb8dd0db9ianh<directivesynopsis>
a47a28784ca46876076471d2a0b45c11f800bffestoddard<description>The minimum size (in bytes) of the document to read and be cached
ed4b039edaff2a734bd8da9c33e43e2fb8dd0db9ianh before sending the data downstream</description>
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton</contextlist>
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton <p>The <directive>CacheReadSize</directive> directive sets the
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton minimum amount of data, in bytes, to be read from the backend before the
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton data is sent to the client. The default of zero causes all data read of
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton any size to be passed downstream to the client immediately as it arrives.
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton Setting this to a higher value causes the disk cache to buffer at least
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton this amount before sending the result to the client. This can improve
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton performance when caching content from a reverse proxy.</p>
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton <p>This directive only takes effect when the data is being saved to the
77f0db50b7e6636f6422de76ffb2a0af7acaed6djorton cache, as opposed to data being served from the cache.</p>
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard CacheReadSize 102400
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard </highlight>
08eb8303a91265264085e646f5937c76ae1e0c5bnd</directivesynopsis>
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein<directivesynopsis>
ea92d0ffcb30b186010a2c8ca2c80d2ac09e34dastoddard<description>The minimum time (in milliseconds) that should elapse while reading
ea92d0ffcb30b186010a2c8ca2c80d2ac09e34dastoddard before data is sent downstream</description>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding</contextlist>
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein <p>The <directive>CacheReadTime</directive> directive sets the minimum amount
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding of elapsed time that should pass before making an attempt to send data
08eb8303a91265264085e646f5937c76ae1e0c5bnd downstream to the client. During the time period, data will be buffered
08eb8303a91265264085e646f5937c76ae1e0c5bnd before sending the result to the client. This can improve performance when
08eb8303a91265264085e646f5937c76ae1e0c5bnd caching content from a reverse proxy.</p>
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding <p>This directive only takes effect when the data is being saved to the
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein cache, as opposed to data being served from the cache. It is recommended
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding that this option be used alongside the
e8f95a682820a599fe41b22977010636be5c2717jim <directive module="mod_cache_disk">CacheReadSize</directive> directive to
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard ensure that the server does not buffer excessively should data arrive faster
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard than expected.</p>
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard CacheReadTime 1000
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard </highlight>
fd0075570654d8f3473f12c47f507c8b3c59a8e4stoddard</directivesynopsis>
a47a28784ca46876076471d2a0b45c11f800bffestoddard</modulesynopsis>