Call (877) SITE-OPT (748-3678)

Example 9-1: Sample mod_cache configuration file

Chapter 9 - Advanced Web Performance Optimization

Content is stored in and retrieved from the cache using URI-based keys. Content with access protection is not cached. Example 9-1 shows a sample mod_cache configuration file.

Example 9-1. Sample mod_cache configuration file
# Sample Cache Configuration
#
LoadModule cache_module modules/mod_cache.so

<IfModule mod_cache.c>
#LoadModule disk_cache_module modules/mod_disk_cache.so
# If you want to use mod_disk_cache instead of mod_mem_cache,
# uncomment the line above and comment out the LoadModule line below.
<IfModule mod_disk_cache.c>
CacheRoot c:/cacheroot
CacheEnable disk /
CacheDirLevels 5
CacheDirLength 3
</IfModule>

LoadModule mem_cache_module modules/mod_mem_cache.so
<IfModule mod_mem_cache.c>
CacheEnable mem /
MCacheSize 4096
MCacheMaxObjectCount 100
MCacheMinObjectSize 1
MCacheMaxObjectSize 2048
</IfModule>

# When acting as a proxy, don't cache the list of security updates
CacheDisable http://security.update.server/update-list/
</IfModule>

CacheDirLevels, set to 5, is the number of directory levels below the cache root that will be included in the cache data. CacheDirLength, set to 3, sets the number of characters in proxy cache subdirectory names.

For more details, see the Apache documentation at http://httpd.apache.org/docs/2.2/mod/mod_cache.html.

Copyright © 2002-2017 Website Optimization, LLC. All Rights Reserved - Free website speed test - Privacy Policy
Last modified: February 19, 2009.

Follow us on: Twitter, Google+, Facebook, Linked In