CacheService

Cache clearing helper functions

Internal

only to be used within Extbase, not part of TYPO3 Core API.

Table of Contents

Properties

$cacheTagStack  : SplStack
$clearCacheForTables  : array<string|int, mixed>

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
getCacheTagStack()  : SplStack
clearPageCacheForGivenRecord()  : void
Finds the right PID(s) of a given record and loads the TYPO3 page cache for the given record.

Properties

$cacheTagStack

protected SplStack $cacheTagStack

$clearCacheForTables

protected array<string|int, mixed> $clearCacheForTables = []

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|array<string|int, int>|string $pageIdsToClear = null ]) : void
Parameters
$pageIdsToClear : int|array<string|int, int>|string = null

single or multiple pageIds to clear the cache for

Tags
todo

This method should be hardened to only accept integers or an array of integers

getCacheTagStack()

public getCacheTagStack() : 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

Search results