Clears the Vallic Cloud CDN when Drupal invalidates its caches, and tags every public page so the CDN knows which pages a change affects. There is nothing to configure: on Vallic Cloud, every environment with the CDN on is given what the module needs.

Sponsored and maintained by Vallic.

Features

  • Tags public pages. Every public response carries a CDN-Tag header. Each tag is five characters, so 170 fit in the 1024 bytes the CDN keeps, with list and entity tags first.
  • Purges by tag. The tags a request invalidates are gathered and sent once, after the response has gone to the browser.
  • You choose what reaches the CDN. Cache Purifier's blocklist, aliases, buckets and rules apply to the header and the purges alike.
  • Waits when it has to. A purge the platform can't take right away waits in a queue that cron sends.
  • No CDN key on the site. The site asks the machine it runs on, with a token that clears only its own environment's cache.
  • Same code everywhere. On a laptop, in CI, or with the CDN off, nothing is sent and no header is added. The status report says which.

Requirements

  • Drupal 11.3 or later, or Drupal 12
  • PHP 8.3 or later
  • Cache Purifier, installed with it by Composer

Installation

composer require drupal/vallic_purge
drush en vallic_purge

Export your configuration, so every environment has the module. Then set Browser and proxy cache maximum age under Configuration → Development → Performance, since the CDN keeps only pages Drupal says may be cached.

Clearing everything after a deploy

A release that changes templates, stylesheets or scripts changes every page, and no cache tag says so. Make emptying the CDN the last deploy step in vallic.yaml:

deploy:
  steps:
    - 'drush deploy'
    - 'drush vallic-purge:all'

If the platform can't be reached, the purge waits for cron and the step still succeeds.

Drush

  • drush vallic-purge:all empties this environment's CDN cache.
  • drush vallic-purge:tags node:12,node_list clears the pages carrying these cache tags.
  • drush vallic-purge:urls https://www.example.com/news clears these addresses.

Choosing what reaches the CDN

Cache Purifier's rules target this module's invalidator, vallic_purge.cache_tags_invalidator. For example, to keep visitoring:

visitors:
  label: 'Visitors do not purge the CDN'
  tags: ['*']
  targets: [vallic_purge.cache_tags_invalidator]
  roles: [anonymous, authenticated]

Need help using or extending this module?

    Vallic
  • Hire the project maintainers: Vallic builds and supports Drupal sites, and runs Vallic Cloud, Drupal hosting.
  • Community support: Use the issue queue
Supporting organizations: 
Development & Maintenance

Project information

Releases