Skip to main content
InterviewHubPRO
Section Overview
Q40

Question 40 of 50

Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

80%
Redis & Caching (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

Cache Penetration & Bloom Filters.

senior LevelMost AskedSystem Design

In Simple Words: Cache Penetration occurs when queries request non-existent keys (e.g. id = -9999 sent by an attacker). Since the key is neither in Redis nor the DB, every request bypasses the cache and hammers the database:

  • Mitigation 1 (Null Caching): Cache the non-existent result with a short TTL (SET user:-9999 "NULL" EX 60).
  • Mitigation 2 (Bloom Filter): A space-efficient probabilistic data structure placed in front of the cache. If the Bloom filter says the key does not exist, reject the request immediately without touching Redis or the DB!