Code Room
System designHardsd-g321
Subject Cache invalidationLevel Senior–Staff~45 minCommon in Databases & SQL · Distributed systems · Code quality & review · Algorithms & data structures interviewsIndustries Technology

Question

Design dependency-tracked cache invalidation for a GraphQL/API layer where a single cached response is derived from many underlying entities (a user's dashboard caches data from 12 different objects). When any underlying entity changes, exactly the cached responses that depend on it must be invalidated — no more, no less. Over-invalidation kills hit rate; under-invalidation serves stale data. Design how you track dependencies between cached responses and source entities at scale (millions of cached responses), and the trade-offs of the tracking granularity.

What a strong answer looks like

Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.

Narrate your design
Loading whiteboard…
Run or narrate your approach, then ask the coach.