Apache > HTTP Server > Documentation > Version 2.4 > Modules

Apache Module mod_cache_disk

Available Languages:  en  |  fr  |  ja  |  ko 

Description:Disk based storage module for the HTTP caching filter.
Module Identifier:cache_disk_module
Source File:mod_cache_disk.c


mod_cache_disk implements a disk based storage manager for mod_cache.

The headers and bodies of cached responses are stored separately on disk, in a directory structure derived from the md5 hash of the cached URL.

Multiple content negotiated responses can be stored concurrently, however the caching of partial content is not yet supported by this module.

Atomic cache updates to both header and body files are achieved without the need for locking by storing the device and inode numbers of the body file within the header file. This has the side effect that cache entries manually moved into the cache will be ignored.

The htcacheclean tool is provided to list cached URLs, remove cached URLs, or to maintain the size of the disk cache within size and/or inode limits. The tool can be run on demand, or can be daemonized to offer continuous monitoring of directory sizes.


mod_cache_disk requires the services of mod_cache, which must be loaded before mod_cache_disk.


mod_cache_disk 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_cache_disk as the corresponding settings are not available to the module when a request is being served from the cache.

Support Apache!


Bugfix checklist

See also


CacheDirLength Directive

Description:The number of characters in subdirectory names
Syntax:CacheDirLength length
Default:CacheDirLength 2
Context:server config, virtual host

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