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-sqliteThe 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-redisHow extensions use storage
Each extension namespaces its keys with a 4-byte prefix to avoid collisions:
| Extension | Operations |
|---|---|
| Cache | get/set response JSON with TTL check |
| Rate Limit | increment per-key-per-minute counters |
| Usage | increment per-key-per-model token counters |
| Budget | increment per-key spend in microdollars |