All questions
System Design

What is caching and why is it used?

Caching stores copies of frequently accessed data in a fast layer so future requests are served quickly instead of recomputing or re-fetching from a slower source. It is one of the highest-impact tools in system design because most workloads are read-heavy with a small hot set.

Caches live at many layers: the browser, a CDN at the edge, an in-memory store like Redis in front of a database, and application memory. An eviction policy (commonly LRU — least recently used) decides what to drop when the cache fills.

The central trade-off is staleness: cached data can fall out of sync with the source, so you need an invalidation strategy — time-to-live (TTL) expiry, write-through, or write-around — chosen for how fresh the data must be. In an interview, explain what you would cache (hot, expensive-to-compute, rarely-changing data), where, and how you would keep it fresh, then acknowledge that cache invalidation is famously one of the hard problems.

Practise this live with NostrobeAI

Get real-time, structured guidance for coding, system design, and behavioral interviews. Free trial, no subscription.

Download Free Trial