CacheInstruction

FinalYes

This class contains cache details and is created or updated in middlewares of the Frontend rendering chain and added as Request attribute "frontend.cache.instruction".

Its main goal is to disable the Frontend cache mechanisms in various scenarios, for instance when the admin panel is used to simulate access times, or when security mechanisms like cHash evaluation do not match.

Table of Contents

Methods

disableCache()  : void
Instruct the core Frontend rendering to disable Frontend caching. Extensions with custom middlewares may set this.
getDisabledCacheReasons()  : array<string|int, mixed>
isCachingAllowed()  : bool

Methods

disableCache()

Instruct the core Frontend rendering to disable Frontend caching. Extensions with custom middlewares may set this.

public disableCache(string $reason) : void

Note multiple cache layers are involved during Frontend rendering: For instance multiple TypoScript layers, the page cache and potentially others. Those caches are read from and written to within various middlewares. Depending on the position of a call to this method within the middleware stack, it can happen that some or all caches have already been read of written.

Extensions that use this method should keep an eye on their middleware positions in the stack to estimate the performance impact of this call. It's of course best to not use the 'disable cache' mechanic at all, but to handle caching properly in extensions.

Parameters
$reason : string

getDisabledCacheReasons()

public getDisabledCacheReasons() : array<string|int, mixed>
Internal

Typically only consumed by extensions like EXT:adminpanel

Return values
array<string|int, mixed>

isCachingAllowed()

public isCachingAllowed() : bool
Return values
bool

        
On this page

Search results