The Block Purge module allows administrators to clear the caches for specific active blocks on their Drupal site. It provides a form to select blocks and then invalidates their cache tags to ensure updated content is displayed.
Block Purge clears the cache of the blocks you choose, and only of those blocks. When a block shows outdated content, clear it in one click, without clearing the cache of the whole site.
Features
- Precise: clears the chosen blocks and the pages they are on. Other blocks and pages keep their cache, so the site stays fast.
- Everywhere: in Drupal's render and page caches, and in reverse proxies or CDNs that follow cache tags, such as Varnish or a CDN through the Purge module.
- From the Block layout: a Clear cache operation on each block.
- Many blocks at once: a page listing the placed blocks, filtered by theme or text, to clear the ones you select.
- Cache information for each block: how long it is cached, what it varies by, and its cache tags, to find out why a block is outdated.
- Optionally clear what the blocks show, such as a custom block, a menu or a view, everywhere it is shown.
- Drush command to clear blocks by name, theme or region.
- Logged: who cleared which blocks.
- Safe: its own permission, and links that cannot be triggered from another site.
Requirements
- Drupal 10.3 or later, or Drupal 11.
- The core Block module.
Installation
Install as you would normally install a contributed Drupal module. For further information, see Installing Drupal Modules.
composer require drupal/block_purge drush pm:enable block_purge
Roles with the Administer blocks permission get the Clear block caches permission on installation.
Usage
- In Structure » Block layout, open the operations of a block and choose Clear cache.
- Or go to Configuration » Development » Clear block cache (
/admin/config/development/block-cache-clear), select blocks and click Clear the cache of the selected blocks.
Drush
# One or more blocks, by machine name. drush block-purge:clear olivero_main_menu,olivero_site_branding # Every block of a theme, or of one region. drush block-purge:clear --theme=olivero --region=header # Also what the blocks show, such as the menu of a menu block. drush block-purge:clear olivero_main_menu --content
How it works
Every cached copy of a block is tagged with the block's cache tag, such as config:block.block.olivero_main_menu. Block Purge invalidates those tags, as Drupal does when a block is saved, so only the cached copies that include those blocks are cleared.
Upgrading from 1.0
Run drush updatedb.
Support
Report bugs and request features in the issue queue.
Ask your assistant about Block Purge
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
- block Drupal core
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.