Skip to content
docsv0.1.0

InMemoryEventStore

Array-backed {@see EventStoreInterface}: same append/replay/nextSeq contract as {@see FileEventStore}, kept entirely in process memory. For tests and zero-file consumers — nothing is written to disk and nothing survives past the instance's lifetime.

InMemoryEventStore::append()

public function append(Milpa\EventStore\Event $event): void

Appends `$event` to the in-memory log. Events are never mutated or removed once appended.

Parameters

Parameters of append()
NameTypeDescription
$eventMilpa\EventStore\Event

InMemoryEventStore::replay()

public function replay(string $streamId): array

All events belonging to `$streamId`, in ascending `seq` order.

Parameters

Parameters of replay()
NameTypeDescription
$streamIdstring

InMemoryEventStore::nextSeq()

public function nextSeq(): int

The next `seq` to assign, one past the highest `seq` currently in the store (across every stream) — `1` for an empty store.

InMemoryEventStore::streams()

public function streams(): array

Every distinct stream id present in the store, in the order each first appears (ascending `seq` of its first event).