This module provides a hash-based cache for Panels and other Chaos Tools powered displays.

This support caching based on any combination of:

  • Contexts (node, term, user etc)
  • Arguments
  • Drupal Path (args) (same as the Panels Page Cache Module)
  • Full URL (including domain and query string)
  • Users
  • Roles

It also supports "simple" caching. If you would like to see it cache based on something I haven't thought of yet, open-up a feature request and I will likely add it.

The main advantage to using a hash-based cache is that the cache is automatically expired* when any of these items change. This means that you get automatic and instant refreshes of your cached item when your node , user, or term (or what-have-you) is updated. This means that you can more aggressively set your TTL on your caches, knowing that they will automatically be updated and thereby achieving a much higher hit ratio.

The other advantage is that you can cache based on the combination of *any* of the above items. Want your cache to be updated when either the context *or* the user's role changes? No problem!

* The disadvantage is that the cache is updated not by a TTL expiration of the cache-object, but by changing the cache-id. This means that you can end up with unused cache objects in your caching backend. These unused cache-entries *do* eventually get expired and cleared when their TTL runs out, but it can take a bit longer. For this reason I would recommend using this module with memcache, not the default MySQL cache tables.

Also of note is that it takes approximately 1 millisecond to compute the hashes for the cache (generally between 0.7 and 1.3 ms).

New Feature: You can now manually reset the cache by passing a URL query parameter "panels-hash-cache-reset={key}", where {key} is a configurable secret string. In this fashion, you can set-up a cron job to reload your caches so that users *never* hit an uncached page. This can be useful if you have pages that take a very long time to generate.

This module exists thanks to the generous support of HighWire Press and Stanford University

Supporting organizations: 
Maintaining
Maintaining

Project Information

Downloads