‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Cache\CacheManager Class Reference
Inheritance diagram for TYPO3\CMS\Core\Cache\CacheManager:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct (bool $disableCaching=false)
 
 setCacheConfigurations (array $cacheConfigurations)
 
 registerCache (FrontendInterface $cache, array $groups=[])
 
FrontendInterface getCache ($identifier)
 
bool hasCache ($identifier)
 
 flushCaches ()
 
 flushCachesInGroup ($groupIdentifier)
 
 flushCachesInGroupByTag ($groupIdentifier, $tag)
 
 flushCachesInGroupByTags ($groupIdentifier, array $tags)
 
 flushCachesByTag ($tag)
 
 flushCachesByTags (array $tags)
 
string[] getCacheGroups ()
 
 handleCacheFlushEvent (CacheFlushEvent $event)
 

Protected Member Functions

 createAllCaches ()
 
 createCache ($identifier)
 

Protected Attributes

FrontendInterface[] $caches = array( )
 
array $cacheConfigurations = array( )
 
array $cacheGroups = array( )
 
array $defaultCacheConfiguration
 
bool $disableCaching = false
 

Detailed Description

The Cache Manager

Definition at line 35 of file CacheManager.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Cache\CacheManager::__construct ( bool  $disableCaching = false)

Member Function Documentation

◆ createAllCaches()

◆ createCache()

TYPO3\CMS\Core\Cache\CacheManager::createCache (   $identifier)
protected

Instantiates the cache for $identifier.

Parameters
string$identifier
Exceptions
DuplicateIdentifierException
InvalidBackendException
InvalidCacheException

Definition at line 301 of file CacheManager.php.

References TYPO3\CMS\Webhooks\Message\$identifier, and TYPO3\CMS\Core\Cache\CacheManager\registerCache().

Referenced by TYPO3\CMS\Core\Cache\CacheManager\createAllCaches(), and TYPO3\CMS\Core\Cache\CacheManager\getCache().

◆ flushCaches()

TYPO3\CMS\Core\Cache\CacheManager::flushCaches ( )

Flushes all registered caches

Definition at line 153 of file CacheManager.php.

References TYPO3\CMS\Core\Cache\CacheManager\createAllCaches().

◆ flushCachesByTag()

TYPO3\CMS\Core\Cache\CacheManager::flushCachesByTag (   $tag)

Flushes entries tagged by the specified tag of all registered caches.

Parameters
string$tag‪Tag to search for

Definition at line 234 of file CacheManager.php.

References TYPO3\CMS\Core\Cache\CacheManager\createAllCaches().

◆ flushCachesByTags()

TYPO3\CMS\Core\Cache\CacheManager::flushCachesByTags ( array  $tags)

Flushes entries tagged by any of the specified tags in all registered caches.

Parameters
string[]$tags‪Tags to search for

Definition at line 247 of file CacheManager.php.

References TYPO3\CMS\Core\Cache\CacheManager\createAllCaches().

◆ flushCachesInGroup()

TYPO3\CMS\Core\Cache\CacheManager::flushCachesInGroup (   $groupIdentifier)

Flushes all registered caches of a specific group

Parameters
string$groupIdentifier
Exceptions
NoSuchCacheGroupException

Definition at line 167 of file CacheManager.php.

References TYPO3\CMS\Core\Cache\CacheManager\createAllCaches().

Referenced by TYPO3\CMS\Core\Cache\CacheManager\handleCacheFlushEvent().

◆ flushCachesInGroupByTag()

TYPO3\CMS\Core\Cache\CacheManager::flushCachesInGroupByTag (   $groupIdentifier,
  $tag 
)

Flushes entries tagged by the specified tag of all registered caches of a specific group.

Parameters
string$groupIdentifier
string | array$tag‪Tag to search for
Exceptions
NoSuchCacheGroupException

Definition at line 188 of file CacheManager.php.

References TYPO3\CMS\Core\Cache\CacheManager\createAllCaches().

◆ flushCachesInGroupByTags()

TYPO3\CMS\Core\Cache\CacheManager::flushCachesInGroupByTags (   $groupIdentifier,
array  $tags 
)

Flushes entries tagged by any of the specified tags in all registered caches of a specific group.

Parameters
string$groupIdentifier
string[]$tags‪Tags to search for
Exceptions
NoSuchCacheGroupException

Definition at line 212 of file CacheManager.php.

References TYPO3\CMS\Core\Cache\CacheManager\createAllCaches().

◆ getCache()

FrontendInterface TYPO3\CMS\Core\Cache\CacheManager::getCache (   $identifier)

Returns the cache specified by $identifier

Parameters
string$identifier‪Identifies which cache to return
Returns
‪FrontendInterface The specified cache frontend
Exceptions
NoSuchCacheException

Definition at line 128 of file CacheManager.php.

References TYPO3\CMS\Webhooks\Message\$identifier, TYPO3\CMS\Core\Cache\CacheManager\createCache(), and TYPO3\CMS\Core\Cache\CacheManager\hasCache().

Referenced by TYPO3\CMS\Core\Localization\LocalizationFactory\__construct(), TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory\__construct(), and TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManager\__construct().

◆ getCacheGroups()

string [] TYPO3\CMS\Core\Cache\CacheManager::getCacheGroups ( )
Returns
‪string[]

Definition at line 259 of file CacheManager.php.

◆ handleCacheFlushEvent()

TYPO3\CMS\Core\Cache\CacheManager::handleCacheFlushEvent ( CacheFlushEvent  $event)

◆ hasCache()

bool TYPO3\CMS\Core\Cache\CacheManager::hasCache (   $identifier)

Checks if the specified cache has been registered.

Parameters
string$identifier‪The identifier of the cache
Returns
‪bool TRUE if a cache with the given identifier exists, otherwise FALSE

Definition at line 145 of file CacheManager.php.

References TYPO3\CMS\Webhooks\Message\$identifier.

Referenced by TYPO3\CMS\Core\Cache\CacheManager\getCache().

◆ registerCache()

TYPO3\CMS\Core\Cache\CacheManager::registerCache ( FrontendInterface  $cache,
array  $groups = [] 
)

Registers a cache so it can be retrieved at a later point.

Parameters
FrontendInterface$cache‪The cache frontend to be registered
array$groupsCache groups to be associated to the cache
Exceptions
DuplicateIdentifierException‪if a cache with the given identifier has already been registered.

Definition at line 109 of file CacheManager.php.

References TYPO3\CMS\Webhooks\Message\$identifier, and TYPO3\CMS\Core\Cache\Frontend\FrontendInterface\getIdentifier().

Referenced by TYPO3\CMS\Core\Cache\CacheManager\createCache().

◆ setCacheConfigurations()

TYPO3\CMS\Core\Cache\CacheManager::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

If one of the options is not specified, the default value is assumed. Existing cache configurations are preserved.

Parameters
array<string,array>‪$cacheConfigurations The cache configurations to set
Exceptions

Definition at line 87 of file CacheManager.php.

References TYPO3\CMS\Core\Cache\CacheManager\$cacheConfigurations, and TYPO3\CMS\Webhooks\Message\$identifier.

Member Data Documentation

◆ $cacheConfigurations

array TYPO3\CMS\Core\Cache\CacheManager::$cacheConfigurations = array( )
protected

◆ $cacheGroups

array TYPO3\CMS\Core\Cache\CacheManager::$cacheGroups = array( )
protected

Used to flush caches of a specific group is an associative array containing the group identifier as key and the identifier as an array within that group groups are set via the cache configurations of each cache.

Definition at line 52 of file CacheManager.php.

◆ $caches

FrontendInterface [] TYPO3\CMS\Core\Cache\CacheManager::$caches = array( )
protected

Definition at line 39 of file CacheManager.php.

◆ $defaultCacheConfiguration

array TYPO3\CMS\Core\Cache\CacheManager::$defaultCacheConfiguration
protected
Initial value:
= array(
'frontend' => VariableFrontend::class,
'backend' => Typo3DatabaseBackend::class,
'options' => [],
'groups' => ['all'],
)

Default cache configuration as fallback

Definition at line 56 of file CacheManager.php.

◆ $disableCaching

bool TYPO3\CMS\Core\Cache\CacheManager::$disableCaching = false
protected

Definition at line 65 of file CacheManager.php.

Referenced by TYPO3\CMS\Core\Cache\CacheManager\__construct().