Interview Databases & Caching

How do you decide what to cache and what not to cache?

Databases & Caching · Advanced level

Answer

I cache data that is frequently read, expensive to fetch or compute, reasonably small, and tolerant of staleness. I avoid caching rapidly changing, sensitive, authorization-heavy, cheap, or strict-consistency data.

Technical explanation

Good cache candidates are hot, expensive, small, and stale-tolerant.

Bad candidates are rapidly changing, sensitive, huge, cheap to query, or strict-consistency data.

Authorization-heavy data requires special care because stale permissions are a security risk.

Hands-on example

Decision examples:

Cache product category list: yes.

Cache payment balance: no, read primary.

Cache user permissions for 1 hour: risky; prefer short TTL or token/revocation design.

Preparing for an interview?

Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.

More Databases & Caching interview questions

← All Databases & Caching questions