<-
Apache > HTTP Server > Documentation > Version 2.2 > Modules

Please note

This document refers to the 2.2 version of Apache httpd, which is no longer maintained. The active release is documented here. If you have not already upgraded, please follow this link for more information.

You may follow this link to go to the current version of this document.

Apache Module mod_disk_cache

Available Languages:  en  |  ja  |  ko 

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

Summary

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

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

htcacheclean can be used to maintain the cache size at a maximum level.

Note:

mod_disk_cache requires the services of mod_cache.

Note:

mod_disk_cache uses the sendfile feature to serve files from the cache when supported by the platform, and when enabled with EnableSendfile. However, per-directory and .htaccess configuration of EnableSendfile are ignored by mod_disk_cache as the corresponding settings are not available to the module when a request is being served from the cache.

Directives

top

CacheDirLength Directive

Description:The number of characters in subdirectory names
Syntax:CacheDirLength length
Default:CacheDirLength 2
Context:server config, virtual host
Status:Extension
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

top

CacheDirLevels Directive

Description:The number of levels of subdirectories in the cache.
Syntax:CacheDirLevels levels
Default:CacheDirLevels 3
Context:server config, virtual host
Status:Extension
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

top

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:Extension
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

top

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:Extension
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

top

CacheRoot Directive

Description:The directory root under which cache files are stored
Syntax:CacheRoot directory
Context:server config, virtual host
Status:Extension
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

Available Languages:  en  |  ja  |  ko 

top

Comments

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Libera.chat, or sent to our mailing lists.