Sourcing::Plugin::StateCache

Abstract role defining the interface for state caching backends. State caches handle the storage and retrieval of projection state for faster recovery and reduced event replay overhead.

Overview

The StateCache role handles projection state persistence:

See also: Sourcing::Plugin::EventStore for the event storage interface.

Abstract Methods

method store-cached-data(Mu:U, %)

Stores the current state and version of a projection. Implementations should persist the projection data along with the last processed event ID.

ParameterTypeDescription
Mu:UTypeThe projection type
%HashAdditional data to cache (IDs, state, etc.)

method get-cached-data(Mu:U, %) is rw

Retrieves the cached state and version for a projection. Returns a Hash with last-id and data keys.

ParameterTypeDescription
Mu:UTypeThe projection type
%HashIdentity criteria

Returns: A Hash with:

Class Methods

method use(|c)

Activates this plugin as the current sourcing configuration by setting PROCESS::<$SourcingConfig>.

Sourcing::Plugin::StateCache::Memory.use;

Use Cases

State caching is particularly useful for:

See Also