Tuesday, November 23, 2010

Cache Actions


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.

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.

For more information about Drupal Development, Drupal Expert, Drupal Developer and Drupal Programmer visit at http://www.dckap.com

Source: http://drupal.org/node/927276 

No comments:

Post a Comment