Problem Statement
Explain a practical three-tier caching strategy for a global read API.
Explanation
Tier one is the browser or app cache with conditional GETs. Tier two is CDN or edge cache close to users to absorb most hits. Tier three is a regional in-memory store like Redis to protect the origin. Each tier has its own TTL and validation policy. Together they cut latency and confine failures. Use ETag or versioned keys so edges can revalidate cheaply and avoid serving stale data after updates.
Code Solution
SolutionRead Only
Client cache -> CDN (max-age=300) -> Redis (TTL 120) -> Service/DB
