Search by

yireo / magento2-autoflushcache

yireo

Package info

github.com/yireo/Yireo_AutoFlushCache

Type:magento2-module

pkg:composer/yireo/magento2-autoflushcache

Fund package maintenance!

yireo

www.paypal.me/yireo

Statistics

Installs: 15 867

Dependents: 0

Suggesters: 0

Stars: 28

Open Issues: 0

2.0.2 2023-09-27 10:29 UTC

This package is auto-updated.

Last update: 2026-11-25 08:46:52 UTC


README

Magento version PHP version License Latest Version

Magento 2 module to automatically flush the cache whenever you save something in the System Configuration.

Do NOT use this in production.

Overview

When saving the System Configuration within Magento 2, the core behaviour is to add a reminder in the backend that you should manually flush the cache. In production, this is a good practice: Instead of flushing the cache with every change, the cache is only flushed when needed. In development, I always keep caching on, and then this becomes annoying. This module automatically flushes the cache for you.

Installation

Install this module within Magento 2 using composer:

composer require yireo/magento2-autoflushcache --dev
bin/magento module:enable Yireo_AutoFlushCache

Technical architecture

This module listens to the event admin_system_config_save, which is only dispatched after the System Configuration has been saved successfully. It then refreshes the following cache types:

  • config
  • block_html
  • full_page

The cache types are only refreshed when:

  • Magento runs in developer mode;
  • The current admin user is allowed to refresh cache types (ACL resource Magento_Backend::refresh_cache_type).

Other cache entries are left alone: The entire cache storage is not flushed. Every refresh is logged (including the admin username) to the system log.

Current status

Static Tests Unit Tests Integration Tests Playwright DI Compilation