
Motivation
When you change something specific in your module/profile/theme code but:
- A full cache clear feels excessive since most of it is unrelated to your change.
- It's often hard to remember exactly what service or command can clear/rebuild what, and methods to do so vary by name.
This module provides a plug-in manager, base plug-in, several commonly used plug-ins, along with Drush commands and a UI sub-module to invoke them as needed.
Requirements
- Drupal 10.4 or 11.1
- PHP 8.1 or newer
Optional
- Drush 11 or newer
Usage
Once installed, two Drush commands become available:
rebuilder- runs a specified Rebuilder; alias forrebuilder:run.rebuilder:list- lists all available Rebuilder plug-ins.
A Rebuilder UI sub-module is also provided that adds an administration form where individual Rebuilders can be invoked. Once the module is enabled, this can be found under:
Administration / Configuration / Development / Performance / Rebuilder
or the path: /admin/config/development/performance/rebuilder
Questions and answers
- Why not just clear the cache?
- On smaller and simpler sites, this isn't much of a problem, but if you're running a larger and more complex site, the performance hit can be significant, slowing down the site for everyone. It also isn't necessary in most cases due to how well designed Drupal's cache API is, allowing precise invalidation of just the areas of the cache that are relevant.
- Can I write my own plug-ins?
- Absolutely! In fact, that's one of the reasons this module is built around a plug-in manager rather than hard-coding it all. See the Drupal Plug-in API documentation for how to implement your own.
- Why is this named Rebuilder and not Rebuild?
- There's already a Drush Rebuild project with the Composer name of
drupal/rebuild. Additionally, thecache:rebuildDrush command has an alias ofrebuild. Rebuilder was chosen as a name to avoid collision with these.
Project information
- Project categories: Developer tools, Performance
3 sites report using this module
- Created by ambient.impact on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
