Caching in Apache 2


CacheEnable disk / CacheRoot /usr/local/apache/cache


The caching and proxying functionality in Apache was split into separate modules starting with Apache 2. While in Apache 2.0 the caching functionality is considered experimental, it is considered of production quality in Apache 2.1/2.2

In Apache 2, the main caching functionality is implemented by mod_cache, which in turn has two backends: mod_mem_cache, which stores cached resources directly in memory, and mod_disk_cache, which uses the file system. The CacheEnable directive takes a caching backend (mem or disk) parameter and a URL prefix. Requests that contain the URL prefix will be cached by the specified backend. You can use CacheDisable to disable caching for specific URLs. You can use the htcacheclean command-line utility to prune the cache at predefined intervals when using the disk backend.

Alternatively, if you have frequently requested files that you know will not change during the life of the server, you can use mod_file_cache to tell Apache to map specific files into memory or cache file handles:

CacheFile /usr/local/apache/htdocs/navigationbar.gif MMapFile /usr/local/apache/htdocs/button_left.png


If you modify any of the static files, you will need to restart the server for the changes to take effect.




Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net