Durable Workflow PHP SDK — API Reference

Guides

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

Properties

$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]

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

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|null

metrics()

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

continues()

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
bool

key()

private static key(string $workflowId, string $runId, string $buildId) : string
Parameters
$workflowId : string
$runId : string
$buildId : string
Return values
string

sequenceOf()

private static sequenceOf(array<string, mixed> $event) : int|null
Parameters
$event : array<string, mixed>
Return values
int|null
On this page

Search results