What is a cache, and what are the primary reasons for adding one to a system?
What is the difference between a cache hit and a cache miss, and what do we mean by a 'cold' versus a 'warm' cache?
What is the difference between memoization and caching?
When is caching actually a bad idea? Can you name scenarios where adding a cache would decrease performance or reliability?
How does the principle of temporal and spatial locality justify the use of a cache in the first place?
Why might you choose NOT to cache a piece of data even if it is frequently accessed?
Under what circumstances might adding a cache actually increase the overall latency of a request?
What makes a good cache key? What pitfalls should you avoid when designing cache keys?
What characteristics make a piece of data a good candidate for caching versus a poor one?
What are virtual nodes in consistent hashing and what problem do they solve?
Why is the choice of serialization format (JSON vs. Protobuf vs. Binary) important when designing a high-performance caching layer?
What is the fundamental difference between the Cache-Aside (Lazy Loading) pattern and the Read-Through pattern, and in which layer does the loading logic reside for each?
Explain the trade-off between Write-Through and Write-Back (Write-Behind) caching. Which one would you choose for a system where data loss is unacceptable, and why?
When would you use a Write-Around policy instead of Write-Through, and how does it impact the cache miss rate for subsequent reads?
Compare Write-Through, Write-Back (Write-Behind), and Write-Around. What are the data loss risks associated with Write-Back?
Explain the 'Dual Write' problem. How do you ensure the cache and database don't get out of sync during an update?
Why might you prefer moving caching logic into a library or sidecar (Read-Through) rather than handling it manually in your application code?
In a cache-aside pattern, on a write should you update the cache or delete (invalidate) the entry? Why is deleting often safer?
What happens to a cache when it reaches its memory limit but no TTLs have expired yet?
Compare Least Recently Used (LRU) and Least Frequently Used (LFU). In what specific traffic pattern would LFU outperform LRU?
How would you define and measure a 'Cache Hit Ratio'? What does a high hit ratio with high latency suggest about your cache design?
Explain the trade-off between memory usage and hit ratio when sizing a cache.
If your cache is primarily storing user session data that expires after 30 minutes of inactivity, which eviction policy would you configure and why?
When would Most Recently Used (MRU) eviction outperform LRU?
What is a 'healthy' cache hit ratio, and if your ratio is low, what specific architectural issues or traffic patterns would you investigate?
Explain the concept of the 'Clock' or 'Second Chance' eviction policy. How does it approximate LRU with less overhead?
What is the 'Belady's Anomaly' in the context of FIFO cache eviction?
How does an ARC (Adaptive Replacement Cache) attempt to improve upon standard LRU?
What is the 'Two-Segment' or 'LRU-K' algorithm, and why might it be better than standard LRU for certain workloads?
What happens to a cached resource when a 'Conditional GET' (If-None-Match) returns a 304 Not Modified?
Explain the Cache-Control: no-cache vs. no-store directives. Which one allows the browser to keep a copy?
What is the purpose of the Vary HTTP header in caching, and how does it prevent a mobile user from receiving a cached desktop version of a page?
How do ETags work to facilitate conditional GET requests, and how does this save bandwidth?
Explain the public vs. private directives in Cache-Control. Why is this distinction critical for security when caching authenticated responses?
What is the difference between the ETag and Last-Modified headers?
Explain the difference between freshness (Cache-Control/Expires) and validation (ETag/Last-Modified) in HTTP caching. When does a browser send a Conditional GET?
What is the difference between 'Strong Validation' (ETags) and 'Weak Validation' in HTTP caching?
How does a sliding TTL differ from a fixed TTL?
Explain the Stale-While-Revalidate pattern. How does it improve user-perceived latency while still ensuring data eventually becomes fresh?
What is the purpose of cache warming or pre-warming, and when is it necessary to do this before a deployment or high-traffic event?
What is the difference between evicting data based on a Time-To-Live (TTL) versus evicting based on memory pressure (Max-Memory), and can a key be evicted before its TTL expires?
How do you determine the optimal TTL (Time-to-Live) for a specific piece of data?
What is the difference between active (eager) expiration and lazy (passive) expiration of TTL'd entries, and what are the trade-offs?
What is the difference between explicit (event-based) invalidation and time-based (TTL) expiration, and when would you combine them?
What is 'Refresh-Ahead' caching, and how does it help in reducing tail latency?
What is Cache Penetration, how does it differ from a standard cache miss, and why is negative caching or a bloom filter used to solve it?
Explain the Cache Avalanche scenario. How can jitter (adding randomness to TTLs) prevent a database from crashing during a mass expiration event?
Explain the difference between 'Cache Penetration' and 'Cache Avalanche'. How do their mitigations differ?
How does 'Negative Caching' help protect your downstream database?
What is a Cache Stampede, and how does request coalescing or locking prevent multiple concurrent requests from recomputing the same expensive value?
How do you identify and handle a hot key (a single key receiving disproportionately high traffic) in a distributed cache to prevent a single node from becoming a bottleneck?
What is the difference between a cache avalanche and a cache stampede?
How does a Bloom filter actually work, and why are false positives (but not false negatives) acceptable when using it to guard a cache?
What is the difference between an In-Process (Local) cache and a Distributed (Remote) cache? When would you choose one over the other?
How does consistent hashing minimize cache misses when adding or removing a node from a distributed cache cluster?
What is Consistent Hashing, and why is it preferred over simple 'mod N' hashing for distributing cache keys across a cluster?
Explain the difference between sharding (partitioning) and replication in a cache cluster. Which one helps with read throughput, and which one helps with storage capacity?
From a high-level architectural perspective, why might you choose Redis over Memcached (or vice-versa) for a caching layer?
What is 'Multi-level Caching' (L1/L2 application caches), and how do you manage the complexity of multiple layers?
What is 'Near Caching' and how does it leverage both local and distributed layers?
In a distributed system, how do you ensure cache coherence across different geographical regions?
Invalidation & Consistency
What is the 'Cache Invalidation' problem, and why is it considered one of the 'two hard things' in computer science?
How does using a versioned key (e.g., user:v2:123) help with cache invalidation during a schema change or deployment?
What is the difference between Strong Consistency and Eventual Consistency in a multi-node cache cluster?
Explain the concept of 'Eventual Consistency' in the context of a cache-aside pattern.
Explain the 'Cache Coherence' problem when using local caches across multiple application instances.
If your system requires strong consistency, can you still use a cache, and what are the trade-offs in latency if you do?
How do you propagate cache invalidation across multiple distributed cache nodes or application instances (e.g., via pub/sub or broadcast messages)?