Multi layer cache price flapping
Your task
Users report prices flapping: a product shows $19.99 on one page load and $24.99 on the next, inconsistently, after a pricing update was pushed at 13:00. Dashboards: the DB has the correct new price ($24.99) everywhere; a Redis cache fronts the product read path with a 1-hour TTL; cache hit rate is 92%; there are 8 app instances, each with a small in-process LRU cache in FRONT of Redis (a recent 'optimization' added two weeks ago) holding entries for 10 minutes; no TTL was reduced for the price push. How do you triage the flapping, serve correct prices now, and prevent stale prices on the next update?
It covers
- Cache invalidation
- Stale cache
- Write through
- Redis