Glossary coding Term Page
Redis Cache
Distributed cache built on Redis for consistent reuse across workers.
Core Idea
Redis stores key–value data in memory and supports expiration, atomic increments, and pub/sub. When used as a cache it lets every FastAPI worker read and write the same entries, solving the “each process has its own cache” limitation.
Why It Matters Here
Mathbong’s tutorials serialize query results into Redis, set a TTL, and count hits vs. misses to decide whether to recompute. Even if you begin with Python’s [[lru-cache|lru_cache]], promoting hot data into Redis is the step that keeps performance gains in multi-worker deployments.