Interview practice question
Many threads computing the same value
Backend Engineering · Concurrency · Intermediate
When a cache entry expires, many threads in your service compute the same expensive value at once. How do you prevent duplicate work in-process?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Single-flight per key.
- computeIfAbsent / LoadingCache.
- Future per key shared by waiters.
- Async refresh.
- Same idea as cache stampede protection.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.