Configure automatic cache clearing in Magento
Automatically clear specific caches in Magento when files change during development.

Fresh bytes every Thursday. No spam, ever. Unsubscribe anytime.
Join 9,000+ developers and get three free video lessons every week.
Magento's cache system is great for production, but constantly clearing caches during development can really slow you down. Let's fix that with the magento-cache-clean module, which automatically clears specific caches when you need them cleared.
First, install it as a dev dependency with Composer:
composer require --dev mage2tv/magento-cache-clean
Once installed, start the watcher:
vendor/bin/cache-clean.js --watch
The watcher monitors your Magento files and automatically clears related cache types when files change. For example, if you update a template file, it'll only clear the block and full page caches — leaving all the other cache types untouched.
This will provide you with two major benefits:
- You'll rarely need to manually flush the cache again. The watcher handles nearly every cache clear scenario automatically. That said, you may still need to clear specific caches occasionally for uncommon scenarios, like creating new themes or updating rare XML configurations.
- You can keep all caches enabled during development. Since the watcher flushes the cache intelligently, this will provide you with a significant performance boost when coding.
Note: If you're using the docker-magento development environment, cache-clean is already included and configured — none of this setup is needed. Just go forth and code!