# 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)](/content/docs/crabllm/features/storage#memory-default/index.html)

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 is required.

## [SQLite](/content/docs/crabllm/features/storage#sqlite/index.html)

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](/content/docs/crabllm/features/storage#redis/index.html)

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](/content/docs/crabllm/features/storage#how-extensions-use-storage/index.html)

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 |

### On this page

[Memory (default)](/content/docs/crabllm/features/storage#memory-default/index.html) [SQLite](/content/docs/crabllm/features/storage#sqlite/index.html) [Redis](/content/docs/crabllm/features/storage#redis/index.html) [How extensions use storage](/content/docs/crabllm/features/storage#how-extensions-use-storage/index.html)
