Repeated nonexistent keys can bypass the cache#
GET /users/999999999
cache miss → database lookup → NOT_FOUND
repeat thousands of timesIf “not found” is never stored, every identical invalid request reaches the source. This can happen through client bugs, scans, or deliberate abuse.
Negative caching#
user:999999999 → NOT_FOUND
TTL → short and requirement-drivenA short negative TTL avoids repeating the same database miss. It must not hide a newly created record for longer than the product allows. Bound arbitrary-key cardinality so attackers cannot fill memory with negative entries.
Bloom filter as an advanced gate#
A Bloom filter can cheaply say an identifier is definitely absent, while a positive answer may be a false positive and still requires the normal lookup. It cannot prove that an item exists. The Bloom Filters lesson covers the data structure later.
Related practice problems
Use the manifest-backed prompts below to apply this lesson in a complete design.
- Caching challenges and strategiesAmazon Builders' Library
- Bloom filterRedis Documentation