What it is
Negative caching stores the result that a key has no value, such as a not found or an empty response. Without it, every request for a missing key becomes a full database lookup that returns nothing, wasting backend capacity on repeated dead ends.
Why it matters
- It blocks floods of lookups for keys that simply do not exist.
- It defends against cache penetration, where attackers request random nonexistent keys to bypass the cache and hammer the database.
- It turns an expensive miss into a cheap cached negative result.
The catch
A negative entry can go stale if the key is later created. Negatives should use a short TTL so a newly added value appears quickly, and creation paths should invalidate any negative entry for that key.
Key idea
Negative caching remembers that a key is absent so repeated misses stay cheap, using short TTLs to avoid hiding data that is later created.