This project is not covered by Drupal’s security advisory policy.
Cache Purifier decides which cache tag invalidations reach which caches, and which tags CDNs and reverse proxies see.
Every entity save invalidates cache tags, and Drupal passes them to its own caches and to every purger. Many of those purge nothing useful: a contact message on a site that never shows messages publicly, or a visitor's comment emptying every node listing. Each still costs a purge against the CDN's rate limits, and busy list tags such as node_list keep emptying every listing.
Features
- Invalidation rules. Drop tags per target, whether Drupal's own caches, one purger or all of them, by tag pattern, user role, request path, origin (web or Drush and cron) or a request header. Each rule is edited on its own form.
- Works with any purger that registers as a cache tags invalidator: a CDN module such as bunny.net, a Varnish integration, the Purge module's queuer, or your own.
- Outbound tags. One policy for the tags written into response headers and sent in purges: a blocklist, aliases that merge or rename tags, and buckets that fold large tag families into a fixed number. Headers list the most useful tags first, so a header the CDN cuts short loses the least useful ones.
- Tag report. Counts which kinds of tags are invalidated and which ever appear in a header.
drush cache-purifier:report --apply=<target>turns the ones no public page carries into a rule. - Status report lists the purgers on the site, and warns about rules that also drop tags from Drupal's own caches.
- Examples submodule adds disabled example rules to enable or copy.
Need help using or extending this module?
- Hire the project maintainers: Vallic offers Drupal Commerce support and development, and runs Vallic Cloud, Drupal hosting.
- Community support: Use the issue queue.
Example
private_entities: label: 'Entities no public page shows' tags: ['contact_message:*', 'shortcut:*'] targets: [bunny_net.cache_tags_invalidator] users_keep_lists: label: 'Users without an editorial role keep list tags' tags: ['*_list', '*_list:*'] except: [comment_list] targets: [all] roles: [anonymous, authenticated]
Requirements
- Drupal 11.3 or later, or Drupal 12
- PHP 8.3 or later
Configure under Configuration » Development » Cache Purifier. Rules are stored in cache_purifier.settings, so theith the rest of the site's configuration. See the README for every rule option and how outbound tags work.
Cache Purifier replaces the class of the cache_tags.invalidator service. If another module replaces that service, Cache Pu the status report says the rules are not applied.
Project information
- Project categories: Developer tools, Performance
3 sites report using this module
- Created by valic on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
