Code RoomScan-resistant cache eviction
MediumPrep Room Coding #3444

Scan-resistant cache eviction

System designDistributed systemsMid–Senior~35 min

Your in-memory cache (fixed 64GB) is showing a low hit rate even though the popular working set easily fits in memory. Investigation shows occasional large scans (a batch job, a crawler) pull in thousands of one-hit-wonder keys that evict the genuinely hot keys under plain LRU — cache pollution. Design an eviction/admission policy that resists scan pollution, keeps the genuinely hot working set resident, and adapts as the popularity distribution shifts over time. Discuss how you'd measure that it's working.

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.

Clarify4:00 left
Estimate4:00 planned
Design11:30 planned
Deep dive9:30 planned
Failure6:00 planned
0:00
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.