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.
Write SQL and application-level pseudocode to safely invalidate a cache key when a database row is updated. Consider race conditions where a read may occur between DB commit and cache invalidation and propose patterns to avoid serving stale data.
How would you monitor and measure the business impact of cache-induced performance changes? Describe instrumentation (events, correlated traces), dashboards, and experiments to tie latency reductions to conversion, engagement or revenue metrics.
A marketing campaign will drive sudden spikes to a set of assets for 48 hours. As SRE, outline caching and CDN strategies to handle cold-starts, high concurrency, and cache-busting for campaign assets. Include prefetch, origin shielding, and fallback behaviors.
Explain cache-busting strategies for static assets on deploys (versioned filenames, query string, asset manifest). Discuss pros/cons for CDNs and browser caching, and how to coordinate deploy, purge, and rollback safely.
Design CDN caching rules for an application that serves static assets, public API responses, and authenticated user content. Include rules for cache keys, TTLs, cookie/header handling, origin shielding, TTL purging strategy and how to handle cache-busting for deploys.
Unlock Full Question Bank
Get access to all 27 Caching Strategies & In-Memory Optimization interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.