Lesson 13 of 16
12. Caching: The Basics

Interview questions

11 min read+10 XP

Interview questions (with the counter-questions you'll get)

Interviewers rarely stop at your first answer. For each question below: what they're really testing, a strong answer, the counter-questions they're likely to throw back, and the trap to avoid.

Q1. What is caching, and why would you use it?

They're testing: whether you understand it's about copies, speed and load, not just "makes it fast".

Think about your answer first, then open it.

reveal

Q2. What's a cache hit, a miss, and a hit rate? What's a good hit rate?

They're testing: precise definitions and whether you can reason with numbers.

Think about your answer first, then open it.

reveal

Q3. Why is a cache faster than a database?

They're testing: whether you know why, not just that.

Think about your answer first, then open it.

reveal

Q4. Where would you put a cache in a typical web app?

They're testing: whether you see the whole request path, not just "add Redis".

Think about your answer first, then open it.

reveal

Q5. Walk me through the cache-aside pattern.

They're testing: that you can describe the flow precisely, including the miss path.

Think about your answer first, then open it.

reveal

Q6. How do you keep the cache consistent with the database?

They're testing: whether you know the real-world bug.

Think about your answer first, then open it.

reveal

Q7. How do you choose a TTL?

They're testing: trade-off thinking.

Think about your answer first, then open it.

reveal

Q8. What happens when the cache runs out of memory?

They're testing: eviction policies.

Think about your answer first, then open it.

reveal

Q9. What should you never cache?

They're testing: judgement and safety.

Think about your answer first, then open it.

reveal

Q10. Is the cache a source of truth? What happens if Redis restarts?

They're testing: whether you design for the cache disappearing.

Think about your answer first, then open it.

reveal

Q11. You added a cache, but the database load barely dropped. Why?

They're testing: debugging instinct.

Think about your answer first, then open it.

reveal

Q12. How do you know your cache is working well?

They're testing: operational maturity.

Think about your answer first, then open it.

reveal

Q13. Write-through, write-back or write-around: which would you use?

They're testing: write-path trade-offs.

Think about your answer first, then open it.

reveal

Q14. Cache-aside or read-through?

They're testing: knowing that both exist and why you'd choose.

Think about your answer first, then open it.

reveal