mod_disk_cache

Overview

mod_disk_cache implements a disk-based storage engine for mod_cache .

Quick start

To enable disk-based storage engine for mod_cache use this minimum configuration:

# in server or virtual host config
CacheRoot c:\inetpub\cache

CacheEnable disk /app1
# or via env
SetEnv cache-enable disk

Cache cleanup

Warning! Disk-based cache entries are not deleted after expiration, they are only overwritten by fresh copies. We recommend to clean the cache manually. For example, just delete all directories and files in cache root every day (via scheduler).

Cache can also be cleared with a special request, that sets environment variable cache-clear :

# clear cache if query string contains 'clear_cache_request' and client ip is 11.22.33.44
SetEnvIf (Query_String clear_cache_request) and (Remote_Addr 11\.22\.33\.44) cache-clear=1

Related articles and topics

Directives

Name Context Description
CacheDirLength S V D .h The number of characters in subdirectory names
CacheDirLevels S V D .h The number of levels of subdirectories in the cache.
CacheMaxFileSize S V D .h The maximum size (in bytes) of a document to be placed in the cache
CacheMinFileSize S V D .h The minimum size (in bytes) of a document to be placed in the cache
CacheRoot S V D .h The directory root under which cache files are stored

CacheDirLength

The number of characters in subdirectory names

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

Syntax

CacheDirLength length

Default

CacheDirLength 2

CacheDirLevels

The number of levels of subdirectories in the 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.

Syntax

CacheDirLevels levels

Default:

CacheDirLevels 3

CacheMaxFileSize

The maximum size (in bytes) of a document to be placed in the cache

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

Syntax

CacheMaxFileSize bytes

Default

# 1048576 = 1Mb
CacheMaxFileSize 1048576

CacheMinFileSize

The minimum size (in bytes) of a document to be placed in the cache

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

Syntax

CacheMinFileSize bytes

Default

CacheMinFileSize 1

CacheRoot

The directory root under which cache files are stored

Syntax

CacheRoot directory

Description

CacheRoot directive defines the name of the directory on the disk to contain cache files. If mod_disk_cache module has been loaded in the Helicon Ape configuration, 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.

Example

CacheRoot c:/inetpub/cache