Skip to content

ActionCacheHelper

Static helpers for the action/view cache round trip used by DispatchMiddleware.

Reads and writes go through ActionViewCache, keyed by the module, action and output type of an ActionDescriptor and optionally partitioned by user fingerprint and locale. Both ActionCacheHelper::store() and ActionCacheHelper::read() are no-ops when core.cache_enabled is off (the default) and swallow backend errors, so a failing cache degrades to a miss rather than to a failed request.

ActionCacheHelper::buildContextFromPayload() is the other direction: it validates a stored payload, writes the view selection and validation/security decisions back onto an ExecutionState, and assembles the ActionExecutionContext that a cache hit is served from. No view instance is reconstructed on replay.

final class ActionCacheHelper

SourceExecution/ActionCacheHelper.php
MethodDescription
buildContextFromPayload(array<string, mixed> $payload, ActionDescriptor $desc, ExecutionState $state, ?Action $actionInstance, WebRequest $request, ?string $contentOverride = null): ActionExecutionContextHydrate ExecutionState and build an ActionExecutionContext from a payload.
[`read(ActionViewCache $cache, ActionDescriptor $desc, ?string $userFingerprint = null, ?string $locale = null): array<string, mixed>null`](#read)
store(ActionViewCache $cache, ActionDescriptor $desc, ExecutionState $state, string $content, array<string, mixed> $actionAttributes, bool $isSimple, ?int $ttl = null, ?string $userFingerprint = null, ?string $locale = null): voidUnified cache payload write.

public static function buildContextFromPayload(array<string, mixed> $payload, ActionDescriptor $desc, ExecutionState $state, ?Action $actionInstance, WebRequest $request, ?string $contentOverride = null): ActionExecutionContext

Hydrate ExecutionState and build an ActionExecutionContext from a payload.

ParameterTypeDescription
$payloadarray``<``string``, ``mixed``>
$descActionDescriptor
$stateExecutionState
$actionInstance?Action
$requestWebRequest
$contentOverride?``string

Returns ActionExecutionContext

public static function read(ActionViewCache $cache, ActionDescriptor $desc, ?string $userFingerprint = null, ?string $locale = null): array<string, mixed>|null

Raw read of cached payload (no hydration) – returns array payload or null.

Reads exactly the partition it was asked for. There used to be a fallback to the unpartitioned entry when the per-user lookup missed, which meant a partitioned read could still be answered with content rendered for a different identity — defeating the partitioning on every cold miss. A miss in a partition is a miss.

ParameterTypeDescription
$cacheActionViewCache
$descActionDescriptor
$userFingerprint?``string
$locale?``string

Returns array``<``string``, ``mixed``>``|``null

public static function store(ActionViewCache $cache, ActionDescriptor $desc, ExecutionState $state, string $content, array<string, mixed> $actionAttributes, bool $isSimple, ?int $ttl = null, ?string $userFingerprint = null, ?string $locale = null): void

Unified cache payload write.

ParameterTypeDescription
$cacheActionViewCache
$descActionDescriptor
$stateExecutionState
$contentstring
$actionAttributesarray``<``string``, ``mixed``>
$isSimplebool
$ttl?``int
$userFingerprint?``string
$locale?``string