‪TYPO3CMS  9.5
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)
 
FrontendInterface getCache ($identifier)
 
bool hasCache ($identifier)
 
 flushCaches ()
 
 flushCachesInGroup ($groupIdentifier)
 
 flushCachesInGroupByTag ($groupIdentifier, $tag)
 
 flushCachesInGroupByTags ($groupIdentifier, array $tags)
 
 flushCachesByTag ($tag)
 
 flushCachesByTags (array $tags)
 
 setLimbo (bool $limbo)
 

Protected Member Functions

 createAllCaches ()
 
 createCache ($identifier)
 

Protected Attributes

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

Detailed Description

The Cache Manager

Definition at line 33 of file CacheManager.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

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 154 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 235 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 248 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 168 of file CacheManager.php.

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

Referenced by TYPO3\CMS\Core\DataHandling\DataHandler\clear_cacheCmd(), and TYPO3\CMS\Core\Utility\ExtensionManagementUtility\removeCacheFiles().

◆ 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 189 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 213 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 146 of file CacheManager.php.

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

◆ registerCache()

TYPO3\CMS\Core\Cache\CacheManager::registerCache ( FrontendInterface  $cache)

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

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

Definition at line 113 of file CacheManager.php.

References TYPO3\CMS\Core\Cache\Frontend\FrontendInterface\getIdentifier().

◆ 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$cacheConfigurations‪The cache configurations to set
Exceptions

Definition at line 97 of file CacheManager.php.

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

◆ setLimbo()

TYPO3\CMS\Core\Cache\CacheManager::setLimbo ( bool  $limbo)

Sets the limbo state

If limbo is enable, then getCache() will log a deprecation warning. This method will be removed in TYPO3 v10.0.

Parameters
bool$limbo

Definition at line 348 of file CacheManager.php.

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

◆ $caches

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

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

◆ $disableCaching

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

Definition at line 63 of file CacheManager.php.

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

◆ $limbo

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

Used by Bootstrap to define whether the configuration has been set finally. Controls whether a deprecation warning is logged in getCache(). This property will be removed in TYPO3 v10.0.

Definition at line 72 of file CacheManager.php.