CrabTalkCrabTalk

Storage

Pluggable storage backends — memory, SQLite, and Redis for extension state persistence.

Extensions that persist data (cache, rate limits, usage, budget) use a shared storage backend. Three backends are available.

Memory (default)

In-memory storage using concurrent hash maps. Fast, but data is lost on restart.

[storage]
kind = "memory"

This is the default when no [storage] section is present. No feature flag required.

SQLite

Persistent storage using SQLite via async pooled connections.

[storage]
kind = "sqlite"
path = "crabllm.db"

Requires the storage-sqlite feature:

cargo install crabllm --features storage-sqlite

The database file is created automatically if it doesn't exist.

Redis

Remote persistent storage using Redis async multiplexed connections.

[storage]
kind = "redis"
path = "redis://127.0.0.1:6379"

Requires the storage-redis feature:

cargo install crabllm --features storage-redis

How extensions use storage

Each extension namespaces its keys with a 4-byte prefix to avoid collisions:

ExtensionOperations
Cacheget/set response JSON with TTL check
Rate Limitincrement per-key-per-minute counters
Usageincrement per-key-per-model token counters
Budgetincrement per-key spend in microdollars

On this page