AXIAM PHP SDK

InMemoryReplayStore
in package
implements ReplayStore

FinalYes

The default {@see ReplayStore}: one process's memory, entries expiring after the window.

Table of Contents

Interfaces

ReplayStore
Remembers the `jti`s an {@see SsfReceiver} already accepted (CONTRACT.md ยง32.7 step 9).

Methods

__construct()  : mixed
checkAndRecord()  : bool
Record `$jti` for `$windowSeconds` and return `true`, or return `false` without recording when it is already held. MUST be atomic: two concurrent calls with one `jti` must not both see `true` (a shared store implements this with an atomic add, e.g. Redis `SET NX EX`).

Methods

__construct()

public __construct([callable(): int|null $clock = null ]) : mixed
Parameters
$clock : callable(): int|null = null

The current time in seconds; time() when omitted.

checkAndRecord()

Record `$jti` for `$windowSeconds` and return `true`, or return `false` without recording when it is already held. MUST be atomic: two concurrent calls with one `jti` must not both see `true` (a shared store implements this with an atomic add, e.g. Redis `SET NX EX`).

public checkAndRecord(string $jti, int $windowSeconds) : bool
Parameters
$jti : string
$windowSeconds : int
Return values
bool
On this page

Search results