5.3 Enabling and Configuring the Caching Module

You can also enable mod_cache, which implements an RFC 2616-compliant HTTP content cache that can be used to cache either local content or content available through a proxy. This caching module is disabled by default.

  1. From the Modules page, click Mod_Cache.

  2. Click On.

  3. Click Save > Save to save your changes.

    or

    Click Save > Save and Apply to save your changes and restart Apache so your changes are immediately put into effect.

    For information about where configuration information is stored, see Section 2.3.3, Saving Configuration Changes and Restarting Apache in Apache Manager.

    After the caching module has been enabled, configuration options are available on the Mod Cache page.

    Mod Cache page
  4. In the Default Cache Expiration field, specify a default time, in seconds, to cache a document if neither an expiry date nor last-modified date are provided with the document.

    The value specified in the Maximum Cache Expiration field does not override this setting.

  5. In the Maximum Cache Expiration field, specify the maximum number of seconds that HTTP documents, capable of being cached, are retained without checking the origin server.

    This means that cached documents are never older than the number of seconds you specify here. This maximum value is enforced even if an expiry date was supplied with the document.

  6. (Optional) Next to Ignore Cache Control, select Yes if you want Apache to cache documents that contain a no-cache or no-store header value.

    Some Web documents might contain a no-cache or no-store header value, which means that the Web server won't store them in the server's cache. Ignore Cache Control overrides these header values by telling the server to cache documents even if they contain these header values. Documents requiring authorization are never cached.

  7. In the Cache Size field, specify the maximum amount of memory to be used by the cache, in kilobytes (1024-byte units).

    If a new object needs to be inserted in the cache and the size of the object is greater than the remaining memory, objects are removed until the new object can be cached. The object to be removed is selected using the algorithm specified by the MCacheRemovalAlgorithm directive.

    See the MCacheRemovalAlgorithm Directive documentation on Apache.org for more information.

  8. In the Maximum Object Count field, specify the maximum number of objects that can be cached.

    This value is used to create the open hash table. If a new object needs to be inserted in the cache and the maximum number of objects has been reached, an object is removed to allow the new object to be cached. The object to be removed is selected using the algorithm specified by the MCacheRemovalAlgorithm directive.

    See the MCacheRemovalAlgorithm Directive documentation on Apache.org for more information.

  9. In the Minimum Object Size field, specify the minimum size (in bytes) a document must be in order for it to be cached.

  10. In the Maximum Object Size field, specify the maximum size (in bytes) a document can be in order for it to be cached.

For more information about the mod_cache module, see Apache Module mod_cache on the Apache.org Web site.