\Drupal\strata\Journal MemoryJournal

A journal held in memory.

Used by the unit lane and by a one-shot command that captures and flushes in a single process. A site uses the database-backed journal, which survives a request ending between capture and flush.

Summary

Methods
Properties
Constants
append
read
trim
pending
pendingBytes
oldest
clear
No public properties found
No public constants found
No protected methods found
No protected properties found
No protected constants found
No private methods found
entries
sequence
No private constants found

Properties

$entries

$entries : array

Appended entries in capture order, keyed by sequence.

Type

array<int, JournalOp, payload: string|null}> —

$sequence

$sequence : int

The last sequence assigned.

Type

int

Methods

append()

append(\Drupal\strata\Journal\JournalOp  $operation, ?string  $payload = null) : \Drupal\strata\Journal\JournalOp

Appends an operation and its payload.

Parameters

\Drupal\strata\Journal\JournalOp $operation

The operation to append.

?string $payload

The value the operation captured, or NULL for an operation that carries none.

Returns

\Drupal\strata\Journal\JournalOp —

The operation as appended, carrying its assigned sequence.

read()

read(int  $limit = 5000) : list<array{operation: \Drupal\strata\Journal\JournalOp, payload: string|null}>

Reads a window of operations in capture order, oldest first.

Parameters

int $limit

Most operations to return.

Returns

list

Operations paired with their payloads.

trim()

trim(int  $throughSequence) : int

Removes every operation up to and including a sequence.

Parameters

int $throughSequence

The highest sequence to remove.

Returns

int —

How many operations were removed.

pending()

pending() : int

How many operations are waiting.

Returns

int —

The pending count.

pendingBytes()

pendingBytes() : int

Bytes of payload waiting.

Returns

int —

The pending payload total.

oldest()

oldest() : int|null

Unix microseconds of the oldest waiting operation.

Returns

int|null —

The microtime, or NULL when nothing is waiting.

clear()

clear() : int

Removes everything without flushing it.

Returns

int —

How many operations were removed.