Last updated 30 May 2012. Created on 30 September 2010.
Edited by kratkar, mitchell, jordojuice, pmackay. Log in to edit this page.


Cache Actions is a way to get complete control over your cache and when it should be invalidated. It does so by defining rules actions for the rules module. These actions can be used to define exactly how you want to invalidate your cache. You can for instance decide to clear the cache of some views when content of a specific type is created, or when a user with a specific role creates a comment.

Other cache invalidation techniques

Drupal Core and other contributed modules handles the way cache invalidation happens differently from the cache actions. Here are some examples:

Time-based cache

This is used by Drupal core page caching (if you set the maximum time to live) and the bundled views and panels modules. It basicly clears the cache after a specified period of time has passed. This method can be great if you don't have a need for always up-to-date content.

Built-in caching logic

When you build a module, you can sometimes predict when the cache should be cleared for a particular item. You could for instance be quite sure that the caching for the node page should be invalidated when new content has been created. This is leveraged by Drupal Core for page caching of nodes, in order for new content in nodes and comments to show up.

Examples of module that use this technique is views content cache for views and the expire module that is used by boost and can be used to clear varnish pages. These methods are great since they are easy to set up and provides the

The Cache Actions way of doing it

Cache Actions takes the configure more code less approach to the caching problem by letting you configure exactly the way you want the cache to be invalidated. By supporting views, panels and varnish, it is also a quite complete solution. It has the downside of being harder to configure than a built-in solution, but in return it gives you complete control of how the cache invalidation should work.

Looking for support? Visit the forums, or join #drupal-support in IRC.


doublejosh’s picture

Would be really nice have a sample rule for cleaning a node on update.

Sarah_G’s picture

I found this article to be extremely helpful: I totally misunderstood the Minimum Cache Lifetime setting on the Performance page and could not understand why my content wasn't clearing even with my cache actions and rules set correctly.