CacheService

class \TYPO3\CMS\Extbase\Service\CacheService

Implements
SingletonInterface

Cache clearing helper functions

Table of Contents

Interfaces

SingletonInterface
"empty" interface for singletons (marker interface pattern)

Properties

$cacheManager  : CacheManager
$clearCacheForTables  : array
$configurationManager  : ConfigurationManagerInterface
$connectionPool  : ConnectionPool
$hasPidColumn  : array
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

$clearCacheForTables

protected array $clearCacheForTables = []

$hasPidColumn

As determining the table columns is a costly operation this is done only once per table during runtime and cached then

protected array $hasPidColumn = []

Tags

see
clearPageCache()

$pageIdStack

protected SplStack $pageIdStack

Methods

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|int[] $pageIdsToClear = null ]) : void

Parameters

$pageIdsToClear : int|int[] = null

single or multiple pageIds to clear the cache for

getPageIdStack()

public getPageIdStack() : SplStack

Return values

SplStack

clearPageCacheForGivenRecord()

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

On this page