two-tier cache
A cache with a small, very fast local layer inside each server process (L1) in front of a larger shared layer such as Redis (L2).
In more detail
A read checks L1 first, then L2, then the database, and copies whatever it finds back into the faster tiers. The hard part is invalidation: when data changes, every server’s L1 must be told, usually with a pub/sub message.
Related terms
- cache — A store of earlier answers kept close to where they are needed so they can be reused instead of fetched or computed again.
- Redis — A very fast in-memory data store used for shared caches, rate-limit counters, session data and pub/sub messaging.
- publish-subscribe — A messaging pattern where senders publish messages to a named channel and every subscriber listening on that channel receives a copy.
- backfill — Filling in data after the fact, such as copying old values into a newly added column or copying a found value into a faster cache.
Taught in
- Distributed Cache Invalidation: Redis & Tagged Purging — Production Full-Stack Engineering