mmoreram / cache-flush-bundle
Symfony cache flusher
Installs: 18 505
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.1
- mmoreram/base-bundle: ^1.0
- symfony/dependency-injection: ^3.2
- symfony/event-dispatcher: ^3.2
- symfony/framework-bundle: ^3.2
- symfony/http-kernel: ^3.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^1.12.4
- mmoreram/php-formatter: ^1.3.1
- phpunit/phpunit: ^5.6.4
README
Flush all your kernel content with a simple Symfony service.
$this ->container ->get('cache_flusher') ->flushCache()
by default the service will flush the cache of the kernel loaded in the framework, but you can explicitly flush one kernel's cache by passing the kernel as the first and unique method's parameter.
$myOtherKernel = // $this ->container ->get('cache_flusher') ->flushCache($myOtherKernel)
You can inject the service as well.
my_service: class: MyService\Namespace arguments: '@cache_flusher'
The service dispatches as well two events, one just before flush the kernel's
cache, and another one just after. In both cases, an instance of
CacheFlushEvent
is dispatched, with the used kernel inside.
my_event_listener:
class: MyEventListener\Namespace
tags:
- { name: kernel.event_listener, event: cache.pre_flush }
- { name: kernel.event_listener, event: cache.on_flush }