cache-architect
Advanced caching strategies, Redis architectural patterns, cache-aside, write-through, and cache stampede prevention.
SKILL.mdskills/cache-architect/SKILL.md
GitHubAdvanced Caching Architecture Protocol
Design resilient, consistent, and performant caching tiers.
1. Cache-Aside Pattern (Standard)
- Check cache for key. If hit, return data.
- If miss, load from authoritative database, populate cache with explicit TTL, and return data.
- On entity update: Invalidate the cache key immediately rather than attempting manual in-place patching.
2. Cache Stampede Prevention
When high-traffic keys expire, thousands of requests hit the database simultaneously:
- Implement early probabilistic recomputation (XFetch algorithm) or distributed mutex locks.
- Recompute the cache in the background right before official TTL expiration when read velocity spikes.
- Add randomized TTL jitter so grouped keys do not expire simultaneously.