[APACHE DOCUMENTATION]

Apache HTTP Server Version 2.0

Apache Module mod_cache

Description: Content cache keyed to URIs.
Status: Experimental
Module Identifier: cache_module

Summary

This module is experimental. Documentation is still under development...

mod_cache implements an RFC 2616 compliant HTTP content cache that can be used to cache either local or proxied content. mod_cache requires the services of one or more storage management modules. Two storage management modules are included in the base Apache distribution:

mod_disk_cache
implements a disk based storage manager for use with mod_proxy
mod_mem_cache
implements an in-memory based storage manager. mod_mem_cache can be configured to operate in two modes: caching open file descriptors or caching objects in heap storage. mod_mem_cache is most useful when used to cache locally generated content or to cache backend server content for mod_proxy configured for ProxyPass (aka reverse proxy)

Content stored and retrived keyed to the URL. Content with access protections is not cached.

Directives

Related Modules and Directives

Related Modules

mod_disk_cache
mod_mem_cache
Related Directives

CacheRoot
CacheSize
CacheGcInterval
CacheDirLevels
CacheDirLength
CacheExpiryCheck
CacheMinFileSize
CacheMaxFileSize
CacheTimeMargin
CacheGcDaily
CacheGcUnused
CacheGcClean
CacheGcMemUsage
MCacheSize
MCacheMaxObjectCount
MCacheMinObjectSize
MCacheMaxObjectSize
MCacheRemovalAlgorithm

Sample Configuration

Sample httpd.conf

#
# Sample Cache Configuration
#
LoadModule cache_module modules/mod_cache.so
<IfModule mod_cache.c>

#LoadModule disk_cache_module modules/mod_disk_cache.so
<IfModule mod_disk_cache.c>
CacheRoot c:/cacheroot
CacheSize 256
CacheEnable disk /
CacheDirLevels 5
CacheDirLength 3
</IfModule>

LoadModule mem_cache_module modules/mod_mem_cache.so
<IfModule mod_mem_cache.c>
MCacheEnable mem /
MCacheSize 4096
MCacheMaxObjectCount 100
MCacheMinObjectSize 1
MCacheMaxObjectSize 2048
</IfModule>

</IfModule>

CacheDefaultExpire Directive

Description:
Syntax: CacheDefaultExpire seconds
Default: CacheDefaultExpire 3600 (one hour)
Context: server config
Status: Experimental
Module: mod_cache

The default time in seconds to cache a document if the page does not have an expiry date in the Expires field.

CacheDefaultExpire 86400

CacheDisable Directive

Description: Disable caching of specified URLs by specified storage manager
Syntax: CacheDisable cache_type url-string
Context: server config
Status: Experimental
Module: mod_cache

The CacheDisable directive instructs mod_cache to not cache urls at or above url-string.

Example

CacheDisable disk /local_files

CacheEnable Directive

Description: Enable caching specified URLs in a specified storage manager
Syntax: CacheEnable cache_type url-string
Context: server config
Status: Experimental
Module: mod_cache

The CacheEnable directive instructs mod_cache to cache urls at or below url-string. The cache store is specified with the cache_type argument. cache_type mem instructs mod_cache to use the in-memory cache storage manager implemented by mod_mem_cache. cache_type disk instructs mod_cache to use the cache storage manager implemented by mod_disk_cache .

CacheEnable disk /
CacheEnable mem /manual
CacheEnable fd /images

CacheForceCompletion Directive

Description: Percentage of download to arrive for the cache to force complete transfert
Syntax: CacheLastModifiedFactor Percentage
Default: CacheLastModifiedFactor 60
Context: server config
Status: Experimental
Module: mod_cache

Percentage of download to arrive for the cache to force complete transfert.

CacheForceCompletion
This feature is currently not implemented.

CacheForceCompletion Directive

Description: Percentage of download to arrive for the cache to force complete transfert
Syntax: CacheLastModifiedFactor Percentage
Default: CacheLastModifiedFactor 60
Context: server config
Status: Experimental
Module: mod_cache

Percentage of download to arrive for the cache to force complete transfert.

CacheForceCompletion
This feature is currently not implemented.

CacheIgnoreCacheControl Directive

Description: Ignore requests from the client for uncached content
Syntax: CacheIgnoreCacheControl
Context: server config
Status: Experimental
Module: mod_cache

Ignore requests from the client for uncached content

CacheIgnoreNoLastMod

CacheIgnoreNoLastMod Directive

Description: Ignore responses where there is no Last Modified Header
Syntax: CacheIgnoreNoLastMod
Context: server config
Status: Experimental
Module: mod_cache

Ignore responses where there is no Last Modified Header

CacheIgnoreNoLastMod

CacheLastModifiedFactor Directive

Description: The factor used to estimate the Expires date from the LastModified date
Syntax: CacheLastModifiedFactor float
Default: CacheLastModifiedFactor 0.1
Context: server config
Status: Experimental
Module: mod_cache

The factor used to estimate the Expires date from the LastModified date.

CacheLastModifiedFactor

CacheMaxExpire Directive

Description: The maximum time in seconds to cache a document
Syntax: CacheMaxExpire seconds
Default: CacheMaxExpire 86400 (one day)
Context: server config
Status: Experimental
Module: mod_cache

The maximum time in seconds to cache a document. The CacheMaxExpire takes precedence over the Expire field from the header.

CacheMaxExpire 604800

Apache HTTP Server Version 2.0

IndexHome