‪TYPO3CMS  10.4
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)
 

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 34 of file CacheManager.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 69 of file CacheManager.php.

References TYPO3\CMS\Core\Cache\CacheManager\$disableCaching.

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 298 of file CacheManager.php.

References 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 176 of file CacheManager.php.

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

Referenced by TYPO3\CMS\Core\DataHandling\DataHandler\clear_cacheCmd().

◆ 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 257 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 270 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 190 of file CacheManager.php.

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

Referenced by TYPO3\CMS\Core\DataHandling\DataHandler\clear_cacheCmd().

◆ 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 211 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 235 of file CacheManager.php.

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

Referenced by TYPO3\CMS\Core\DataHandling\DataHandler\clear_cacheCmd().

◆ getCache()

◆ 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 163 of file CacheManager.php.

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 122 of file CacheManager.php.

References 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 89 of file CacheManager.php.

References TYPO3\CMS\Core\Cache\CacheManager\$cacheConfigurations.

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 51 of file CacheManager.php.

◆ $caches

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

Definition at line 38 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 55 of file CacheManager.php.

◆ $disableCaching

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

Definition at line 64 of file CacheManager.php.

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