Choose your backend¶
Pick based on where your FastAPI workers run. The backend affects operational behavior; it does not decide which user or tenant is entitled to see a cached result.
| InMemory | Redis standalone | |
|---|---|---|
| Setup | No external service | Running Redis server required |
| Shared across processes? | No | Yes |
| Persistent across worker restart? | No | Redis configuration-dependent |
| Production multiworker use | No shared cache | Recommended path |
| Published 0.7.1 entry-count bound | Opt-in immutable per-instance max_entries (unbounded by default); not a byte or per-worker-group cap |
Configure Redis eviction separately |
| Previously published 0.5.0 | Unbounded InMemory; no max_entries |
Redis memory policies remain separate |
| Cache expiry | TTL / optional no-expiry | Redis TTL |
| Scoped namespace clearing | Yes | Yes for supported standalone mode |
| Recommended for | Dev, tests, single worker | Servers with multiple workers |
-
Simple app
Use InMemory to begin without external dependencies.
-
More than one worker
Use Redis when workers must share cached entries.
Unsupported is not the same as experimental
Redis Cluster namespace-wide clearing is unsupported; TLS, Sentinel, failover and managed transport environments are not certified. Memcached/DynamoDB remain experimental and have narrower invalidation/TTL guarantees. See compatibility.
Before caching any response¶
Read privacy and tenant safety. Neither backend automatically discovers hidden identity, permission scopes or response-varying middleware inputs.