Skip to main content

Caching for Backend Performances

Caching stores the result of expensive work, such as a query or rendered response, so repeated requests are served from fast memory instead of recomputing it. In a backend it appears at several layers, from in-process maps to Redis to CDNs, and the hard parts are choosing keys, expiry and invalidation.

Stage: Data Layer · Part of the Backend Performance roadmap · Last reviewed 19 November 2026

What to learn in Caching

Caching interview questions

What is a cache stampede and how do you prevent it?

A stampede happens when a hot key expires and many requests miss at once, all hitting the database to rebuild it. Prevent it with request coalescing or a lock so only one caller recomputes, by adding jitter to TTLs, or by refreshing entries before they expire.

Why is cache invalidation considered hard?

The cache must be updated or cleared whenever the source data changes, across many keys and servers, without serving stale data for too long or dropping the hit rate. Getting both freshness and speed right requires clear rules about who owns the data and how it is versioned.

Where Caching fits in the Backend Performance roadmap

Caching belongs to the Data Layer stage (advanced level), which takes about 14 hours. Usually the bottleneck.

Back to the full Backend Performance roadmap