Caching Every Request with Redis
Josh · March 19, 2026
Each API endpoint uses a simple cache-aside strategy:
- Look for the response in Redis under a stable key.
- On a hit, return it immediately — the database is never touched.
- On a miss, query Postgres, store the JSON in Redis with a short TTL, and return it.
Because the data only changes when we re-seed, a short time-to-live keeps things fresh while still absorbing the vast majority of traffic in memory.