CacheService implements SingletonInterface
Cache clearing helper functions
only to be used within Extbase, not part of TYPO3 Core API.
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Properties
- $cacheManager : CacheManager
- $clearCacheForTables : array<string|int, mixed>
- $configurationManager : ConfigurationManagerInterface
- $connectionPool : ConnectionPool
- $hasPidColumn : array<string|int, mixed>
- As determining the table columns is a costly operation this is done only once per table during runtime and cached then
- $pageIdStack : SplStack
Methods
- __construct() : mixed
- clearCacheForRecord() : void
- Stores a record into the stack to resolve the page IDs later-on to clear the caches on these pages then.
- clearCachesOfRegisteredPageIds() : void
- First, this method checks, if any records are registered (usually via Database Backend) to be analyzed for a page record, if so, adds additional page IDs to the pageIdStack.
- clearPageCache() : void
- Clears the page cache
- getPageIdStack() : SplStack
- clearPageCacheForGivenRecord() : void
- Finds the right PID(s) of a given record and loads the TYPO3 page cache for the given record.
- getTypoScriptFrontendController() : TypoScriptFrontendController|null
Properties
$cacheManager
protected
CacheManager
$cacheManager
$clearCacheForTables
protected
array<string|int, mixed>
$clearCacheForTables
= []
$configurationManager
protected
ConfigurationManagerInterface
$configurationManager
$connectionPool
protected
ConnectionPool
$connectionPool
$hasPidColumn
As determining the table columns is a costly operation this is done only once per table during runtime and cached then
protected
array<string|int, mixed>
$hasPidColumn
= []
Tags
$pageIdStack
protected
SplStack
$pageIdStack
Methods
__construct()
public
__construct(ConfigurationManagerInterface $configurationManager, CacheManager $cacheManager) : mixed
Parameters
- $configurationManager : ConfigurationManagerInterface
- $cacheManager : CacheManager
clearCacheForRecord()
Stores a record into the stack to resolve the page IDs later-on to clear the caches on these pages then.
public
clearCacheForRecord(string $table, int $uid) : void
Make sure to call clearCachesOfRegisteredPageIds() afterwards.
Parameters
- $table : string
- $uid : int
clearCachesOfRegisteredPageIds()
First, this method checks, if any records are registered (usually via Database Backend) to be analyzed for a page record, if so, adds additional page IDs to the pageIdStack.
public
clearCachesOfRegisteredPageIds() : void
Walks through the pageIdStack, collects all pageIds as array and passes them on to clearPageCache.
clearPageCache()
Clears the page cache
public
clearPageCache([int|array<string|int, int> $pageIdsToClear = null ]) : void
Parameters
- $pageIdsToClear : int|array<string|int, int> = null
-
single or multiple pageIds to clear the cache for
getPageIdStack()
public
getPageIdStack() : SplStack
Return values
SplStackclearPageCacheForGivenRecord()
Finds the right PID(s) of a given record and loads the TYPO3 page cache for the given record.
protected
clearPageCacheForGivenRecord(string $tableName, int $uid) : void
If the record lies on a page, then we clear the cache of this page. If the record has no PID column, we clear the cache of the current page as best-effort.
Much of this functionality is taken from DataHandler::clear_cache() which unfortunately only works with logged-in BE user.
Parameters
- $tableName : string
-
Table name of the record
- $uid : int
-
UID of the record
getTypoScriptFrontendController()
protected
getTypoScriptFrontendController() : TypoScriptFrontendController|null