class RuntimeContentCache (View source)

Integrate the ContentCache into the Fusion Runtime

Holds cache related runtime state.

Properties

protected Runtime $runtime
protected bool $enableContentCache
protected bool $inCacheEntryPoint
protected bool $addCacheSegmentMarkersToPlaceholders
protected array $cacheMetadata

Stack of cached segment metadata (lifetime)

protected ContentCache $contentCache
protected array $tags
protected PropertyMapper $propertyMapper

Methods

__construct(Runtime $runtime)

No description

void
addTag(string $key, string $value)

Adds a tag built from the given key and value.

array
flushTags()

Resets the assigned tags, returning the previously set tags.

array
enter(array $configuration, string $fusionPath)

Enter an evaluation

array
preEvaluate(array $evaluateContext, object $fusionObject)

Check for cached evaluation and or collect metadata for evaluation

mixed
postProcess(array $evaluateContext, object $fusionObject, mixed $output)

Post process output for caching information

void
leave(array $evaluateContext)

Leave the evaluation of a path

mixed
evaluateUncached(string $path, array $contextArray)

Evaluate a Fusion path with a given context without content caching

array
buildCacheIdentifierValues(array $configuration, string $fusionPath, object $fusionObject)

Builds an array of additional key / values which must go into the calculation of the cache entry identifier for a cached content segment.

array
buildCacheTags(array $configuration, string $fusionPath, object $fusionObject)

Builds an array of string which must be used as tags for the cache entry identifier of a specific cached content segment.

array
unserializeContext(array $contextArray)

No description

void
setEnableContentCache(bool $enableContentCache)

No description

bool
getEnableContentCache()

No description

Details

__construct(Runtime $runtime)

No description

Parameters

Runtime $runtime

void addTag(string $key, string $value)

Adds a tag built from the given key and value.

Parameters

string $key
string $value

Return Value

void

Exceptions

Exception

protected array flushTags()

Resets the assigned tags, returning the previously set tags.

Return Value

array

array enter(array $configuration, string $fusionPath)

Enter an evaluation

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.

Parameters

array $configuration
string $fusionPath

Return Value

array

An evaluate context array that needs to be passed to subsequent calls to pass the current state

Exceptions

Exception

array preEvaluate(array $evaluateContext, object $fusionObject)

Check for cached evaluation and or collect metadata for evaluation

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).

Parameters

array $evaluateContext

The current evaluation context

object $fusionObject

The current Fusion object (for "this" in evaluations)

Return Value

array

Cache hit state as boolean and value as mixed

mixed postProcess(array $evaluateContext, object $fusionObject, mixed $output)

Post process output for caching information

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.

Parameters

array $evaluateContext

The current evaluation context

object $fusionObject

The current Fusion object (for "this" in evaluations)

mixed $output

The generated output after caching information was removed

Return Value

mixed

The post-processed output with cache segment markers or cleaned for the entry point

void leave(array $evaluateContext)

Leave the evaluation of a path

Has to be called in the same function calling enter() for every return path.

Parameters

array $evaluateContext

The current evaluation context

Return Value

void

mixed evaluateUncached(string $path, array $contextArray)

Evaluate a Fusion path with a given context without content caching

This is used to render uncached segments "out of band" in getCachedSegment of ContentCache.

Parameters

string $path
array $contextArray

Return Value

mixed

TODO Find another way of disabling the cache (especially to allow cached content inside uncached content)

protected array buildCacheIdentifierValues(array $configuration, string $fusionPath, object $fusionObject)

Builds an array of additional key / values which must go into the calculation of the cache entry identifier for a cached content segment.

Parameters

array $configuration
string $fusionPath
object $fusionObject

The actual Fusion object

Return Value

array

protected array buildCacheTags(array $configuration, string $fusionPath, object $fusionObject)

Builds an array of string which must be used as tags for the cache entry identifier of a specific cached content segment.

Parameters

array $configuration
string $fusionPath
object $fusionObject

The actual Fusion object

Return Value

array

array unserializeContext(array $contextArray)

No description

Parameters

array $contextArray

Return Value

array

void setEnableContentCache(bool $enableContentCache)

No description

Parameters

bool $enableContentCache

Return Value

void

bool getEnableContentCache()

No description

Return Value

bool