Many actions on a Drupal site trigger a flush of the entire page cache, including but not limited to (list courtesy of Brian K. Osborne):
- A node is created/edited/deleted
- A block is created/edited/deleted
- A comment is created/edited/deleted
- A vote is registered in a poll
- User profile fields are manipulated
- System theme settings are changed
- Taxonomy terms/vocabularies are manipulated
- Permissions for roles are changed
- Cron is run
Therefore when site content changes frequently, the cache hit rate will suffer. In order to prevent frequent flushes, a Minimum cache lifetime can be specified in Administration » Configuration » Development » Performance. However when this setting is too high, outdated content is served to users, which may not be acceptible under certain circumstances.
Using the Cache Expiration module it is possible to automatically remove a selected set of pages from the cache whenever content is modified. This allows for high Minimum cache lifetime values without risking that stale versions of important content is served to users.
Configure Cache Expiration
- Install the Cache Expiration module.
- Enable the Authcache Builtin Cache Expiration vX module (where X is either 1 or 2 matching the version of the installed Cache Expiration module).
- When using Cache Expiration 1.x, navigate to Administration » Configuration » Development » Performance » Cache Expiration and uncheck the option Include base URL in expires. Then save the configuration.
- When using Cache Expiration 2.x, navigate to Administration » Configuration » System » Cache Expiration and set the implementation to External expiration. Adapt the rest of the settings to your needs and finally save the configuration.
- Then go to Administration » Configuration » Development » Performance and max out the Minimum cache lifetime.
Note that with this settings the whole page cache is still flushed completely once a day. But only selected pages will be removed from the cache when content is updated or a comment is posted.
The Expire Cache module comes with Rules integration. Therefore the expiration logic can be extended in many ways. However remember to always pass internal paths to the expire-action, the Cache Expiration integration for Authcache Builtin Storage Backend does not work with full URLs.
- See for a solution when operating the Expire Cache module in combination with Authcache Builtin Storage Backend on dual HTTP/HTTPS deployment.