Sourcing::Plugin::StateCache::SQLite

SQLite-based implementation of the StateCache interface for persistent projection state.

Overview

This class implements Sourcing::Plugin::StateCache using SQLite for persistent storage. Projection state is cached in a SQLite database and survives process restarts.

When to use: Production deployments requiring persistent projection cache.

Usage

use Sourcing::Plugin::StateCache::SQLite;

# File-based SQLite (persists between runs)
my $cache = Sourcing::Plugin::StateCache::SQLite.new: :path;

# In-memory SQLite (for testing)
my $cache = Sourcing::Plugin::StateCache::SQLite.new;

Configuration

ParameterTypeDefaultDescription
pathStr:memory:Path to SQLite database file

Database Schema

CREATE TABLE projection_cache (
    projection_type TEXT NOT NULL,
    id_key TEXT NOT NULL,
    data TEXT NOT NULL,
    last_id INTEGER NOT NULL,
    updated_at TEXT NOT NULL,
    PRIMARY KEY (projection_type, id_key)
);

See Also