Views content cache

The Views content cache module provides a caching plugin to views that is smart about when the cache should be flushed. It allows you to create a cache whereby a view is only re-rendered if some content contained in that view is changed.

Views caching

The Views module provides a sophisticated plugable caching system. It is slightly different from most caching systems in Drupal modules. Views will cache both the results from the database (results cache) and the rendered results of a view (render cache.) Views will use the data from the cache when a cache plugin says that it is safe to do so.

Cache plugins tell views a maximum age of the data that should be accepted and then if there is data in the cache that is newer than that then it will be used. Cache plugins may specify different ages for the results and render caches.

Content cache

The cache plugin that comes with Views is a simple time based cache, the cache data will be used for a maximum time that you specify, e.g. one day. If new content is posted within that day that should appear in your view, it will not until the end of the day specified by the cache plugin.

The plugin that Views content cache provides however, keeps track of the time that different content types and comments (and more) were updated and then uses that to provide a max lifetime to views that factors in the new or updated content. So that data can still be cached by views, but the maximum age is dynamically adjusted to account for new content, so in theory most views can be safely cached, and will provide up to date content, but perform better than views that are generated each and every page load.

Keeping track of the different bits of content that could appear in a view is quite hard, and Views content cache basically provides a framework for doing so. There are in fact plugins for Views content cache that keep track of the different 'segments': 'node types', 'comments' or 'organic groups', etc. these can be provided by other modules and they can work together to refine the maximum age of views cache data.

Setting up Views content cache

Views content cache is really simple to set up:

Views content cache Developers guide

Views content cache uses ctools to provide a plugable cache segment system. This means that as a developer you can add monitoring of a cache

Guide maintainers

steven jones's picture