PHP Class Neos\Fusion\Core\Cache\RuntimeContentCache

Holds cache related runtime state.
Show file Open project: neos/neos-development-collection Class Usage Examples

Protected Properties

Property Type Description
$addCacheSegmentMarkersToPlaceholders boolean
$cacheMetadata array Stack of cached segment metadata (lifetime)
$contentCache ContentCache
$enableContentCache boolean
$inCacheEntryPoint boolean
$propertyMapper Neos\Flow\Property\PropertyMapper
$runtime Neos\Fusion\Core\Runtime
$tags array

Public Methods

Method Description
__construct ( Runtime $runtime )
addTag ( string $key, string $value ) : void Adds a tag built from the given key and value.
enter ( array $configuration, string $typoScriptPath ) : array Enter an evaluation
evaluateUncached ( string $path, array $contextArray ) : mixed Evaluate a TypoScript path with a given context without content caching
getEnableContentCache ( ) : boolean
leave ( array $evaluateContext ) : void Leave the evaluation of a path
postProcess ( array $evaluateContext, object $tsObject, mixed $output ) : mixed Post process output for caching information
preEvaluate ( array &$evaluateContext, object $tsObject ) : array Check for cached evaluation and or collect metadata for evaluation
setEnableContentCache ( boolean $enableContentCache ) : void
unserializeContext ( array $contextArray ) : array

Protected Methods

Method Description
buildCacheIdentifierValues ( array $configuration, string $typoScriptPath, object $tsObject ) : array Builds an array of additional key / values which must go into the calculation of the cache entry identifier for a cached content segment.
buildCacheTags ( array $configuration, string $typoScriptPath, object $tsObject ) : array Builds an array of string which must be used as tags for the cache entry identifier of a specific cached content segment.
flushTags ( ) : array Resets the assigned tags, returning the previously set tags.

Method Details

__construct() public method

public __construct ( Runtime $runtime )
$runtime Neos\Fusion\Core\Runtime

addTag() public method

Adds a tag built from the given key and value.
public addTag ( string $key, string $value ) : void
$key string
$value string
return void

buildCacheIdentifierValues() protected method

Builds an array of additional key / values which must go into the calculation of the cache entry identifier for a cached content segment.
protected buildCacheIdentifierValues ( array $configuration, string $typoScriptPath, object $tsObject ) : array
$configuration array
$typoScriptPath string
$tsObject object The actual TypoScript object
return array

buildCacheTags() protected method

Builds an array of string which must be used as tags for the cache entry identifier of a specific cached content segment.
protected buildCacheTags ( array $configuration, string $typoScriptPath, object $tsObject ) : array
$configuration array
$typoScriptPath string
$tsObject object The actual TypoScript object
return array

enter() public method

Needs to be called right before evaluation of a path starts to check the cache mode and set internal state like the cache entry point.
public enter ( array $configuration, string $typoScriptPath ) : array
$configuration array
$typoScriptPath string
return array An evaluate context array that needs to be passed to subsequent calls to pass the current state

evaluateUncached() public method

This is used to render uncached segments "out of band" in getCachedSegment of ContentCache.
public evaluateUncached ( string $path, array $contextArray ) : mixed
$path string
$contextArray array
return mixed TODO Find another way of disabling the cache (especially to allow cached content inside uncached content)

flushTags() protected method

Resets the assigned tags, returning the previously set tags.
protected flushTags ( ) : array
return array

getEnableContentCache() public method

public getEnableContentCache ( ) : boolean
return boolean

leave() public method

Has to be called in the same function calling enter() for every return path.
public leave ( array $evaluateContext ) : void
$evaluateContext array The current evaluation context
return void

postProcess() public method

The content cache stores cache segments with markers inside the generated content. This method creates cache segments and will process the final outer result (currentPathIsEntryPoint) to remove all cache markers and store cache entries.
public postProcess ( array $evaluateContext, object $tsObject, mixed $output ) : mixed
$evaluateContext array The current evaluation context
$tsObject object The current TypoScript object (for "this" in evaluations)
$output mixed The generated output after caching information was removed
return mixed The post-processed output with cache segment markers or cleaned for the entry point

preEvaluate() public method

Try to get a cached segment for the current path and return that with all uncached segments evaluated if it exists. Otherwise metadata for the cache lifetime is collected (if configured) for nested evaluations (to find the minimum maximumLifetime).
public preEvaluate ( array &$evaluateContext, object $tsObject ) : array
$evaluateContext array The current evaluation context
$tsObject object The current TypoScript object (for "this" in evaluations)
return array Cache hit state as boolean and value as mixed

setEnableContentCache() public method

public setEnableContentCache ( boolean $enableContentCache ) : void
$enableContentCache boolean
return void

unserializeContext() public method

public unserializeContext ( array $contextArray ) : array
$contextArray array
return array

Property Details

$addCacheSegmentMarkersToPlaceholders protected property

protected bool $addCacheSegmentMarkersToPlaceholders
return boolean

$cacheMetadata protected property

Stack of cached segment metadata (lifetime)
protected array $cacheMetadata
return array

$contentCache protected property

protected ContentCache,Neos\Fusion\Core\Cache $contentCache
return ContentCache

$enableContentCache protected property

protected bool $enableContentCache
return boolean

$inCacheEntryPoint protected property

protected bool $inCacheEntryPoint
return boolean

$propertyMapper protected property

protected PropertyMapper,Neos\Flow\Property $propertyMapper
return Neos\Flow\Property\PropertyMapper

$runtime protected property

protected Runtime,Neos\Fusion\Core $runtime
return Neos\Fusion\Core\Runtime

$tags protected property

protected array $tags
return array