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
| Parameter | Type | Default | Description |
|---|---|---|---|
path | Str | :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
- Sourcing::Plugin::StateCache — the abstract interface
- Sourcing::Plugin::StateCache::Memory — in-memory implementation
- Sourcing::Plugin::EventStore::SQLite — SQLite event store
- Writing a Plugin Guide — how to implement your own plugin