CacheManager
class CacheManager (View source)
The Cache Manager
Properties
protected CacheFactory | $cacheFactory | ||
protected ConfigurationManager | $configurationManager | ||
protected LoggerInterface | $logger | ||
protected Environment | $environment | ||
protected FrontendInterface[] | $caches | ||
protected CacheInterface[] | $simpleCaches | ||
protected CacheItemPoolInterface[] | $cacheItemPools | ||
protected array | $persistentCaches | ||
protected array | $cacheConfigurations |
Methods
Injects the (system) logger based on PSR-3.
Sets configurations for caches. The key of each entry specifies the cache identifier and the value is an array of configuration options.
Registers a cache so it can be retrieved at a later point.
Returns the cache specified by $identifier
Return a SimpleCache frontend for the cache specified by $identifier
Return a SimpleCache frontend for the cache specified by $identifier
Checks if the specified cache has been registered.
Checks if the specified cache is marked as "persistent".
Flushes all registered caches
Flushes entries tagged by the specified tag of all registered caches.
Returns an array of cache configurations, indexed by cache identifier
Flushes entries tagged with class names if their class source files have changed.
Flushes entries tagged with class names if their class source files have changed.
Flushes caches as needed if settings, routes or policies have changed
Flushes I18n caches if translation files have changed
Instantiates all registered caches.
Instantiates the cache for $identifier.
Details
void
injectLogger(LoggerInterface $logger)
Injects the (system) logger based on PSR-3.
void
injectCacheFactory(CacheFactory $cacheFactory)
No description
void
injectConfigurationManager(ConfigurationManager $configurationManager)
No description
void
injectEnvironment(Environment $environment)
No description
void
setCacheConfigurations(array $cacheConfigurations)
Sets configurations for caches. The key of each entry specifies the cache identifier and the value is an array of configuration options.
Possible options are:
frontend backend backendOptions persistent
If one of the options is not specified, the default value is assumed. Existing cache configurations are preserved.
void
registerCache(FrontendInterface $cache, bool $persistent = false)
Registers a cache so it can be retrieved at a later point.
FrontendInterface
getCache(string $identifier)
Returns the cache specified by $identifier
CacheInterface
getSimpleCache(string $identifier)
Return a SimpleCache frontend for the cache specified by $identifier
CacheItemPoolInterface
getCacheItemPool(string $identifier)
Return a SimpleCache frontend for the cache specified by $identifier
bool
hasCache(string $identifier)
Checks if the specified cache has been registered.
bool
isCachePersistent(string $identifier)
Checks if the specified cache is marked as "persistent".
void
flushCaches(bool $flushPersistentCaches = false)
Flushes all registered caches
void
flushCachesByTag(string $tag, bool $flushPersistentCaches = false)
Flushes entries tagged by the specified tag of all registered caches.
array
getCacheConfigurations()
Returns an array of cache configurations, indexed by cache identifier
void
flushSystemCachesByChangedFiles(string $fileMonitorIdentifier, array $changedFiles)
Flushes entries tagged with class names if their class source files have changed.
Also flushes AOP proxy caches if a policy was modified.
This method is used as a slot for a signal sent by the system file monitor defined in the bootstrap scripts.
Note: Policy configuration handling is implemented here as well as other parts of Flow (like the security framework) are not fully initialized at the time needed.
protected void
flushClassCachesByChangedFiles(array $changedFiles)
Flushes entries tagged with class names if their class source files have changed.
protected void
flushConfigurationCachesByChangedFiles(array $changedFiles)
Flushes caches as needed if settings, routes or policies have changed
protected void
flushTranslationCachesByChangedFiles(array $changedFiles)
Flushes I18n caches if translation files have changed
protected void
createAllCaches()
Instantiates all registered caches.
protected void
createCache(string $identifier)
Instantiates the cache for $identifier.