StickyWorkflowCache
in package
FinalYes
Bounded process-local cache keyed by exact workflow/run/build identity.
Values are complete durable histories, never correctness state. A miss, expiry, eviction, worker replacement, or build mismatch therefore falls back to the history supplied by the runtime and a full replay.
Table of Contents
Constants
- MAX_TTL_SECONDS : mixed = 3600
Properties
- $capacity : int
- $clock : callable(): float
-
$entries
: array<string, array{history: list
>, expires_at: float, touched_at: float}> - $metrics : array{hit: int, miss: int, eviction: int, forced_cold_replay: int}
- $ttlSeconds : int
Methods
- __construct() : mixed
- clear() : void
- history() : array<int, array<string, mixed>>|null
- $afterSequence and $lastSequence are the poll answer's sticky_history_suffix v1 fields: 0 marks full history, N > 0 marks events after sequence N only.
- lastSequence() : int|null
- The last sequence of the cached history for this run, or null when none is cached or it has no sequences.
- metrics() : array{hit: int, miss: int, eviction: int, forced_cold_replay: int}
- remember() : void
- ttlSeconds() : int
- continues() : bool
- evictExpired() : void
- key() : string
- sequenceOf() : int|null
Constants
MAX_TTL_SECONDS
public
mixed
MAX_TTL_SECONDS
= 3600
Properties
$capacity read-only
private
int
$capacity
= 100
$clock read-only
private
callable(): float
$clock
$entries
private
array<string, array{history: list>, expires_at: float, touched_at: float}>
$entries
= []
$metrics
private
array{hit: int, miss: int, eviction: int, forced_cold_replay: int}
$metrics
= ['hit' => 0, 'miss' => 0, 'eviction' => 0, 'forced_cold_replay' => 0]
$ttlSeconds read-only
private
int
$ttlSeconds
= 300
Methods
__construct()
public
__construct([int $capacity = 100 ][, int $ttlSeconds = 300 ][, Closure|null $clock = null ]) : mixed
Parameters
- $capacity : int = 100
- $ttlSeconds : int = 300
- $clock : Closure|null = null
clear()
public
clear() : void
history()
$afterSequence and $lastSequence are the poll answer's sticky_history_suffix v1 fields: 0 marks full history, N > 0 marks events after sequence N only.
public
history(string $workflowId, string $runId, string $buildId, array<int, array<string, mixed>> $runtimeHistory, string|null $replayMode[, int|null $afterSequence = null ][, int|null $lastSequence = null ]) : array<int, array<string, mixed>>|null
Parameters
- $workflowId : string
- $runId : string
- $buildId : string
- $runtimeHistory : array<int, array<string, mixed>>
- $replayMode : string|null
- $afterSequence : int|null = null
- $lastSequence : int|null = null
Return values
array<int, array<string, mixed>>|null —Null when authoritative cold history is required.
lastSequence()
The last sequence of the cached history for this run, or null when none is cached or it has no sequences.
public
lastSequence(string $workflowId, string $runId, string $buildId) : int|null
Parameters
- $workflowId : string
- $runId : string
- $buildId : string
Return values
int|nullmetrics()
public
metrics() : array{hit: int, miss: int, eviction: int, forced_cold_replay: int}
Return values
array{hit: int, miss: int, eviction: int, forced_cold_replay: int}remember()
public
remember(string $workflowId, string $runId, string $buildId, array<int, array<string, mixed>> $durableHistory) : void
Parameters
- $workflowId : string
- $runId : string
- $buildId : string
- $durableHistory : array<int, array<string, mixed>>
ttlSeconds()
public
ttlSeconds() : int
Return values
intcontinues()
private
static continues(array<int, array<string, mixed>> $suffix, int $after, int|null $last) : bool
Parameters
- $suffix : array<int, array<string, mixed>>
- $after : int
- $last : int|null
Return values
boolevictExpired()
private
evictExpired(float $now) : void
Parameters
- $now : float
key()
private
static key(string $workflowId, string $runId, string $buildId) : string
Parameters
- $workflowId : string
- $runId : string
- $buildId : string
Return values
stringsequenceOf()
private
static sequenceOf(array<string, mixed> $event) : int|null
Parameters
- $event : array<string, mixed>