Distributed Caching Strategies & Redis Invalidation
Master Cache-Aside, Write-Through, Write-Back caching strategies, Redis LRU eviction policies, and prevent Cache Stampede / Thundering Herd.
Distributed Caching Patterns
### Caching Strategies
- **Cache-Aside (Lazy Loading)**: Application queries cache first; on cache miss, reads from DB and updates cache.
- **Write-Through**: Application writes to cache; cache synchronously updates DB.
- **Cache Stampede (Thundering Herd)**: Occurs when a high-traffic key expires, causing concurrent DB read spikes. Fixed via Distributed Locks or probabilistic early expiration.