Apache HTTP Server Version 2.0

Apache > HTTP Server > Documentation > Version 2.0 > Modules

# Apache Module mod_disk_cache

Description: | Content cache storage manager keyed to URIs
Status: | Experimental
Module Identifier: | disk_cache_module
Source File: | mod_disk_cache.c

### Summary

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

`mod_disk_cache` implements a disk based storage manager. It is primarily of use in conjunction with `mod_proxy`.

Content is stored in and retrieved from the cache using URI based keys. Content with access protection is not cached.

### Note:

`mod_disk_cache` requires the services of `mod_cache`.

### Directives

## CacheDirLength Directive

Description: | The number of characters in subdirectory names
Syntax: | `CacheDirLength length`
Default: | `CacheDirLength 2`
Context: | server config, virtual host
Status: | Experimental
Module: | mod_disk_cache

The `CacheDirLength` directive sets the number of characters for each subdirectory name in the cache hierarchy.

The result of `CacheDirLevels`* `CacheDirLength` must not be higher than 20.

`CacheDirLength 4`

## CacheDirLevels Directive

Description: | The number of levels of subdirectories in the cache.
Syntax: | `CacheDirLevels levels`
Default: | `CacheDirLevels 3`
Context: | server config, virtual host
Status: | Experimental
Module: | mod_disk_cache

The `CacheDirLevels` directive sets the number of subdirectory levels in the cache. Cached data will be saved this many directory levels below the `CacheRoot` directory.

The result of `CacheDirLevels`* `CacheDirLength` must not be higher than 20.

`CacheDirLevels 5`

## CacheExpiryCheck Directive

Description: | Indicates if the cache observes Expires dates when seeking files
Syntax: | `CacheExpiryCheck On|Off`
Default: | `CacheExpiryCheck On`
Context: | server config, virtual host
Status: | Experimental
Module: | mod_disk_cache

More detail will be added here, when the function is implemented.

`CacheExpiryCheck Off
`

The `CacheExpiryCheck` directive is currently not implemented.

## CacheGcClean Directive

Description: | The time to retain unchanged cached files that match a URL
Syntax: | `CacheGcClean hours url-string`
Default: | `CacheGcClean ?`
Context: | server config, virtual host
Status: | Experimental
Module: | mod_disk_cache

More detail will be added here, when the function is implemented.

`CacheGcClean 12 /daily_scripts`

The `CacheGcClean` directive is currently not implemented.

## CacheGcDaily Directive

Description: | The recurring time each day for garbage collection to be run. (24 hour clock)
Syntax: | `CacheGcDaily time`
Default: | `CacheGcDaily ?`
Context: | server config, virtual host
Status: | Experimental
Module: | mod_disk_cache

More detail will be added here, when the function is implemented.

`CacheGcDaily 23:59`

The `CacheGcDaily` directive is currently not implemented.

## CacheGcInterval Directive

Description: | The interval between garbage collection attempts.
Syntax: | `CacheGcInterval hours`
Context: | server config, virtual host
Status: | Experimental
Module: | mod_disk_cache

The `CacheGcInterval` directive specifies the number of hours to wait between attempts to free up disk space.

More detail will be added here, when the function is implemented.

`CacheGcInterval 24
`

The `CacheGcInterval` directive is currently not implemented.

## CacheGcMemUsage Directive

Description: | The maximum kilobytes of memory used for garbage collection
Syntax: | `CacheGcMemUsage KBytes`
Default: | `CacheGcMemUsage ?`
Context: | server config, virtual host
Status: | Experimental
Module: | mod_disk_cache

More detail will be added here, when the function is implemented.

`CacheGcMemUsage 16`

The `CacheGcMemUsage` directive is currently not implemented.

## CacheGcUnused Directive

Description: | The time to retain unreferenced cached files that match a URL.
Syntax: | `CacheGcUnused hours url-string`
Default: | `CacheGcUnused ?`
Context: | server config, virtual host
Status: | Experimental
Module: | mod_disk_cache

More detail will be added here, when the function is implemented.

`CacheGcUnused 12 /local_images`

The `CacheGcUnused` directive is currently not implemented.

## CacheMaxFileSize Directive

Description: | The maximum size (in bytes) of a document to be placed in the cache
Syntax: | `CacheMaxFileSize bytes`
Default: | `CacheMaxFileSize 1000000`
Context: | server config, virtual host
Status: | Experimental
Module: | mod_disk_cache

The `CacheMaxFileSize` directive sets the maximum size, in bytes, for a document to be considered for storage in the cache.

`CacheMaxFileSize 64000`

## CacheMinFileSize Directive

Description: | The minimum size (in bytes) of a document to be placed in the cache
Syntax: | `CacheMinFileSize bytes`
Default: | `CacheMinFileSize 1`
Context: | server config, virtual host
Status: | Experimental
Module: | mod_disk_cache

The `CacheMinFileSize` directive sets the minimum size, in bytes, for a document to be considered for storage in the cache.

`CacheMinFileSize 64`

## CacheRoot Directive

Description: | The directory root under which cache files are stored
Syntax: | `CacheRoot directory`
Default: | `none`
Context: | server config, virtual host
Status: | Experimental
Module: | mod_disk_cache

The `CacheRoot` directive defines the name of the directory on the disk to contain cache files. If the `mod_disk_cache` module has been loaded or compiled in to the Apache server, this directive must be defined. Failing to provide a value for `CacheRoot` will result in a configuration file processing error. The `CacheDirLevels` and `CacheDirLength` directives define the structure of the directories under the specified root directory.

`CacheRoot c:/cacheroot`

## CacheSize Directive

Description: | The maximum amount of disk space that will be used by the cache in KBytes
Syntax: | `CacheSize KBytes`
Default: | `CacheSize 1000000`
Context: | server config, virtual host
Status: | Experimental
Module: | mod_disk_cache

The `CacheSize` directive sets the desired disk space usage of the cache, in KBytes (1024-byte units). This directive does not put a hard limit on the size of the cache. The garbage collector will delete files until the usage is at or below the settings. Always use a value that is lower than the available disk space.

`CacheSize 5000000`

## CacheTimeMargin Directive

Description: | The minimum time margin to cache a document
Syntax: | `CacheTimeMargin ?`
Default: | `CacheTimeMargin ?`
Context: | server config, virtual host
Status: | Experimental
Module: | mod_disk_cache

More detail will be added here, when the function is implemented.

`CacheTimeMargin X`

The `CacheTimeMargin` directive is currently not implemented.