CacheTags is an experimental project to associate cache entries with metadata, which then enables developers to clear caches based on that metadata.
cache_set('some_cid', 'my data', 'cache', time() + $expire, array('node' => array(2, 4), 'user' => array(1, 3)));
This tags the entry with node ID's 2 and 4, and user ID 1 and 3. The entry can then be expired by any combination of those IDs:
cache_invalidate(array('user' => array(1)));
A cache_get() for entries tagged with user ID 1 will subsequently return FALSE, and if the cache is not re-populated, data will be cleaned up after $expire seconds.
Core version status
- 8.x: CacheTags functionality exists in Drupal 8.x, see the API documentation for full details.
- 7.x: core patch simply modifies arguments of
cache_set(). Implementation provided as a cache plugin and schema alter module.
- 6.x: no core patch, implementation exists as a cache plugin and schema alter module.
Note: automatic code testing has been disabled in the issue queue as I'm not aware of any way to apply the necessary core patches (for D7) via the testing system.
Currently there is support for:
Tag counters have their own pluggable storage which may use a different backend than the cache bins themselves.
Credits / Contact
- Maintenance status: Unsupported
- Development status: Obsolete
- Reported installs: 21 sites currently report using this module. View usage statistics.
- Downloads: 5,035
- Last modified: October 6, 2016
- Stable releases are covered by the security advisory policy.
Look for the shield icon below.