- Turn caching on
- Set cache root directory for a proxy server
- Specify cache size (in megabytes)
- No caching for URLs matching a given mask
- Cache only if URL matches a given set of URLs
- Remove everything older than this (in days)
- Remove if has been unused this long (in days)
- Default expiry time if not given by remote server (in days)
- Factor used in approximating expiry date
- Store also expired documents for further efficiency
- Guaranteed freshness of documents
- Time accuracy between hosts
- Standalone cache mode - no external document retrievals
- Turn off expiry checking for standalone operation
- Enable and disable garbage collection
- Time for daily garbage collection
- Garbage collector memory usage directive
- First cache file size limit (kilobytes)
- Second cache file size limit (kilobytes)
- Break cache locks after this timeout
- Log cache accesses to a different log file
CacheRoot directive, which is used to set the absolute
path of the cache directory:
CacheSize directive sets the maximum cache size in
megabytes. Default value is 5MB, but its preferable to have several
megabytes of cache, like 50-100MB, to get best results. Cache may,
however, temporarily grow a few megabytes bigger than specified.
CacheSize 20 Msets cache size to 20 megabytes.
will never be cached, e.g.:
http://really.useless.site/*From version 3.0 on templates can have any number of wildcard characters
directives will be cached, e.g.:
http://really.important.site/*From version 3.0 on templates can have any number of wildcard characters
CacheClean directive will be removed.
This value overrides expiry date in that no file can be stored longer
than this value specifies, regardless of expiry date. Templates can
have any number of wildcard characters (asterisks).
CacheClean http://*.edu/* 1 month CacheClean http:* 3 weeks CacheClean ftp:* 14 days CacheClean gopher:* 5 days 12 hoursThe first matching
CacheClean directive will be applied [this changed in
CacheUnused directive will be removed.
Templates can have any number of wildcard characters (asterisks).
CacheUnused http://www.w3.org/* 7 days CacheUnused ftp://some.server/* 14 days CacheUnused * 4 days 12 hoursNote that the first matching specification will be applied; therefore HTTP files from
w3.org will be
kept 7 days, and not 4.5 days. [The order was
vice-versa before the version 3.0pre4.]
Last-Modified: header will be kept at most the time
Default value is zero for all documents. With HTTP default should
be kept in zero (script replies shouldn't be cached); for FTP and
Gopher you migth consider expiry time such as 6 hours or 1 day.
Without this setting FTP and Gopher documents never get cached because
FTP and Gopher protocols don't have the notion of an expiry or last
CacheDefaultExpiry ftp://ftp.w3.org/* 2 days CacheDefaultExpiry ftp:* 1 day CacheDefaultExpiry gopher:* 6 hours 30 minutesIn case of many
CacheDefaultExpiry directives the first one that matches
will be used [this order was the opposite before the version
Default expiry for HTTP will
almost always cause problems because there are currently many scripts
that don't give an expiry date, yet their output expires immediately.
Therefore, it is better to keep the default value for
http: in zero.
Last-Modified time, but not
Last-Modified can often be successfully used to
approximate expiry date.
the fraction of time since last modification to give the remaining
time to be up-to-date.
Default value is
0.1, which means that e.g. file modified
20 days ago will expire in 2 days.
CacheLastModifiedFactor 0.2would cause files modified 5 months ago to expire after one month.
This feature can be turned off by specifying:
CacheLastModifiedFactor http://www.w3.org/httpd/* 0.10 CacheLastModifiedFactor http://www.w3.org/* 0.15 CacheLastModifiedFactor * 0.20
On the entire cache space is used up
efficiently, and files get removed only when space is needed for new
directive can be used to specify a cache refresh interval for URL's
matching a given pattern. This will cause
httpd to check
that the file is still up-to-date if more than the maximum allowed
time has passed since the last check, even if it would still seem to
be up to date according expiry date.
Note that the cache refresh happens only if and when the document is requested, so if you have a refresh interval of 2 hours it doesn't mean that all the files in cache are fetched every two hours.
As a special case, specifying the refresh interval to be zero every cache access will cause a check to be made from remote server. This is ideal for users who need to have always the absolutely most up-to-date version, but still want faster response times and saves in network costs. This is still cheaper as all the checks are performed using the conditional GET request (with If-Modified-Since header), which sends the document only if it has changed, and otherwise tells the proxy to use the cache.
CacheRefreshInterval http://www.w3.org/httpd/* 1 day CacheRefreshInterval http://www.w3.org/* 5 days CacheRefershInterval http://weather.machine/* 2 hours CacheRefreshInterval * 1 week
CacheTimeMargin defines this
time margin, by default:
CacheTimeMargin 2 minsNo document expiring in less than two minutes will be written to disk.
CacheNoConnect OnDefault setting is naturally
This directive is typically used with expiry checking also turned
CacheExpiryCheck can be turned off:
CacheExpiryCheck OffDefault setting is
On, meaning that proxy never returns an
This is usually used in standalone cache
CacheNoConnect diretive turned
GcDailyGc specifies the time to do daily garbage
collection, normally during the night. Default value is 3:00.
Daily garbage collection can be disabled by specifying
GcDailyGc 3:00Another example: turning daily gc off:
GcMemUsage directive advices garbage collector about how
much memory to use. You may imagine this is the number of kilobytes
to use for gc data, but it may vary greatly according to dynamic
things, like the directory structure of cached files.
Default is 500; if gc fails because memory runs out make this smaller. If your machine has so much memory that it just can't run out, make this very big.
GcMemUsage 100if you have very little memory.
CacheLimit_1 sets the lower
limit; under this all the files have equal size factor.
CacheLimit_2 sets up higher limit; files bigger than this
get extremely bad size factor (meaning they get removed right away
because they are too big).
Sizes are specified in kilobytes, and defaults values are 200K and 4MB, respectively.
CacheLimit_1 200 K CacheLimit_2 4000 Kwould set the same values as the defaults, 200K and 4MB.
directive sets the amount of time after which lock can be broken.
Time is specified like all the other times in the configuration file, and
default value is 20 minutes, the same as default
CacheLockTimeOut should never be less than
CacheLockTimeOut 30 minswould set lock timeout to half an hour.