CacheTags is an experimental project to associate cache entries with metadata, which then
enables developers to clear caches based on that metadata.

Basic syntax:

<?php
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:

<?php
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: core patch contains most of the implementation and represents tentative inclusion in Drupal core. See #636454: Cache tag support for that initiative. cachetags_sql module provided to enable the modified schema on existing sites.
  • 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.

Backend support

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

Currently maintained by Dick Olson and Damien McKenna. All initial development was by Carlos Rodriguez.

Continued development sponsored by Al Jazeera and Mediacurrent.

Downloads

Recommended releases

Version Downloads Date Links
7.x-1.0 tar.gz (12.73 KB) | zip (16.39 KB) 2011-Oct-25 Notes
6.x-1.0 tar.gz (12.91 KB) | zip (16.91 KB) 2011-Oct-25 Notes

Development releases

Project Information


Maintainers for CacheTags

  • DamienMcKenna - 5 commits
    last: 3 weeks ago, first: 4 weeks ago
  • dixon_ - 8 commits
    last: 4 weeks ago, first: 4 weeks ago
  • carlos8f - 38 commits
    last: 1 year ago, first: 1 year ago

Issues for CacheTags

To avoid duplicates, please search before submitting a new issue.
All issues
Bug reports
Statistics (2 years)
New issues
Open bugs
Participants
nobody click here