CacheFlusher
readonly class \
Flushes the caches affected by changed records, pages, cache tags, cache groups and cache commands, without the need of a DataHandler.
Cache tags are flushed in the cache group "pages", unless the demand names another group or "all" for all caches. Cache groups are flushed by dispatching CacheFlushEvent; errors its listeners report are part of the result. All events are dispatched here, callers only describe what to flush. flush() resolves and executes a demand in one go, resolve() alone tells what would be flushed.
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Methods
- __construct() : mixed
- execute() : CacheFlushResult
- Flushes the caches of a plan and dispatches AfterCacheFlushedEvent.
- flush() : CacheFlushResult
- resolve() : CacheFlushPlan
- Resolves a demand into the cache tags and groups to flush, without flushing anything. Dispatches BeforeRecordRelatedCachesAreFlushedEvent for every record and BeforeCacheFlushEvent for the complete plan, so their listeners also run here and must only change what is flushed.
Methods
__construct()
public
__construct(CacheManager $cacheManager, EventDispatcherInterface $eventDispatcher, TcaSchemaFactory $tcaSchemaFactory, CacheFlushPageResolver $pageResolver, OpcodeCacheService $opcodeCacheService, ContainerInterface $container) : mixed
Parameters
- $cacheManager : CacheManager
- $eventDispatcher : EventDispatcherInterface
- $tcaSchemaFactory : TcaSchemaFactory
- $pageResolver : CacheFlushPageResolver
- $opcodeCacheService : OpcodeCacheService
- $container : ContainerInterface
execute()
Flushes the caches of a plan and dispatches AfterCacheFlushedEvent.
public
execute(CacheFlushPlan $plan) : CacheFlushResult
Parameters
- $plan : CacheFlushPlan
Return values
CacheFlushResultflush()
public
flush(CacheFlushDemand $demand[, CacheFlushingContext $context = new CacheFlushingContext() ]) : CacheFlushResult
Parameters
- $demand : CacheFlushDemand
- $context : CacheFlushingContext = new CacheFlushingContext()
Return values
CacheFlushResultresolve()
Resolves a demand into the cache tags and groups to flush, without flushing anything. Dispatches BeforeRecordRelatedCachesAreFlushedEvent for every record and BeforeCacheFlushEvent for the complete plan, so their listeners also run here and must only change what is flushed.
public
resolve(CacheFlushDemand $demand[, CacheFlushingContext $context = new CacheFlushingContext() ]) : CacheFlushPlan
Parameters
- $demand : CacheFlushDemand
- $context : CacheFlushingContext = new CacheFlushingContext()