TopicsCaching
Caching
Latency wins, stampede control, and invalidation that does not lie.
Common tags: redis, ttl, cache-aside
- Caching
Distributed Caching Consistency — Local vs Shared Cache & Near-Cache
Cluster · Redis cache
A near-cache (L1 in each pod) on top of a shared L2 (Redis) removes the network hop for hot keys, but every write must now reach every pod. Invalidate L2, fan out a versioned message to every L1, keep L1 TTL short, and flush L1 when a subscriber reconnects.
Open study →- near-cache
- distributed-cache
- consistency
- local-cache
- invalidation-bus
- interview
- Caching
Cache Invalidation — TTL vs Event-Driven vs Versioned Keys
Cluster · Redis cache
Invalidation is how you stop serving lies. TTL is the safety net, event-driven DEL tracks writes, and versions stop a slow reader from writing an old snapshot back after your DEL. Combine them and design for the invalidation path failing.
Open study →- cache-invalidation
- ttl
- event-driven
- versioned-keys
- cdc
- consistency
- interview
- Caching
Write-Through vs Write-Behind Caching
Cluster · Redis cache
Cache-aside invalidates after DB commit. Write-through warms cache on the write path. Write-behind acks from cache/queue and flushes later — faster writes, durability risk.
Open study →- caching-data-stores
- redis
- Caching
Single-Flight Locking for Cache Fills
Cluster · Redis cache
Coalesce concurrent misses with SET NX PX. Lock TTL vs load p99. Token + Lua unlock. Waiters poll the data key. Combine with in-process singleflight.
Open study →- caching-data-stores
- redis
- Caching
Redis Eviction Policies & Memory Management
Cluster · Redis cache
maxmemory plus a policy. Caches usually allkeys-lru or allkeys-lfu. volatile-* protects keys without TTL. noeviction makes writes fail. Pick string/hash/list/set/zset/stream from the access pattern; RDB vs AOF vs none from durability. Eviction is not capacity planning.
Open study →- caching-data-stores
- redis
- Caching
Negative Caching
Cluster · Redis cache
Cache the fact that a key does not exist with a distinct sentinel and a short TTL. Invalidate on create. Miss storms on absent keys are as dangerous as hot hits.
Open study →- caching-data-stores
- redis
- Caching
Cache TTL Design & Jitter
Cluster · Redis cache
TTL is a staleness bound. Identical TTLs create expiry cliffs. Add jitter; use soft TTL / XFetch on hot keys; size TTL from business tolerance, not habit.
Open study →- caching-data-stores
- redis
- ttl
- Caching
Redis Cache-Aside, Invalidation & Stampede Prevention
Cluster · Redis cache
Cache-aside + delete-on-write; TTL jitter; single-flight SET NX PX + Lua unlock; XFetch; negative caching.
Open study →- caching-data-stores
- redis