Enabling mod_disk_cacheTo make mod_disk_cache working one should perform the following simple steps:
- Create disk cache folder. Say,
- Grant Read & Write permisions for that folder to users running Application Pools on your IIS. By default it's IIS_IUSRS group.
- Point to that folder in httpd.conf using
- Enable caching for requests to
/app/for example. To do that, specify in httpd.conf:
or in .htaccess inside /app/ folder:
CacheEnable disk /app/
mod_disk_cache saves cached requests into hierarchical folder structure inside CacheRoot. Length of names and levels of these folders are defined by
CacheDirLevelsdirectives. Caching gives out even better effect when used together with mod_gzip module which compresses response before caching and sending it to the client.
Pros and cons of disk cachingThe tests we've conducted showed that the speed of mem-based and disk-based cache is roughly equal.
The main advantage of disk cache is that cached data is stored on disk and does not depend on applications recycling, IIS and hardware reset, in contrast to memory cache that is stored until the first application recycling or IIS reset.
The shortage of disk cache lies in absense of intrenal recycling mechanism for the expired records that are not used any more. But that's not that critical:) The workaround may be: configure sheduled recycling of all cache once a day, i.e. remove all subfolders (or aged records only) and their content from