Caching Strategies & In-Memory Optimization Questions

Designing cache layers to cut redundant work and speed up reads, and the correctness costs that come with them. Covers cache placement across client, CDN, application, and in-memory store tiers, including platform-specific caching on mobile (in-memory and disk caches on iOS and Android, secure on-device token storage) and in the browser (localStorage, IndexedDB, Service Workers). Covers eviction policies, TTLs, write-through vs write-back, warming, and invalidation, plus cache stampede and thundering-herd mitigation when a hot key expires under load. Also covers using an in-memory store like Redis directly rather than only as a cache: distributed locks, counters, rate limiters, and leaderboards. Includes distributed and sharded cache architecture (replication, failover, sizing, migration) and the operational side of running one: health monitoring, alerting, and incident runbooks, plus the security and privacy risks caching introduces, such as cache poisoning and caching PII across shared tenants. Emphasizes hit-rate reasoning and the staleness/consistency trade-offs caching introduces.

EasyTechnical
56 practiced

Explain what caching is in the context of web frontends. List the typical layers where caching occurs (browser, CDN/edge, origin, application, data store), describe three key benefits caching provides for user-facing applications, and name one common downside or risk when caching is misconfigured.

MediumTechnical
51 practiced

A hot key in your system is drawing so many concurrent requests that its expiry threatens to stampede the origin. What could you do on the client and what could you do on the server to prevent that, and how would you decide which side should own the fix?

MediumTechnical
47 practiced

Write a service worker fetch handler (in JavaScript) that applies a stale-while-revalidate strategy for static assets under '/static/' and a network-first strategy with a short timeout for API requests under '/api/'. The handler should update caches appropriately and avoid blocking the response while updating caches.

HardSystem Design
60 practiced

Design a global CDN invalidation service capable of handling thousands of invalidation requests per minute, supporting path-pattern invalidations and surrogate key based purges, while minimizing API rate limits, de-duplicating requests, and ensuring eventual consistency across edge regions. Outline the components, API design, and scaling considerations.

EasyTechnical
47 practiced

Describe the purpose and differences between these HTTP headers used for caching: Cache-Control, Expires, ETag, and Last-Modified. For each header give a short example value and a scenario where that header is most appropriate for frontend assets or API responses.

Unlock Full Question Bank

Get access to all 19 Caching Strategies & In-Memory Optimization interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.