Grokking Redis
0% completed
3.7 Negative Caching with Bloom Filters
Ask a Bloom filter in Redis about an ID that was never added, and it answers 0 without touching the database:
127.0.0.1:6379> BF.RESERVE bf:items 0.001 50000000 OK 127.0.0.1:6379> BF.ADD bf:items item:1001 (integer) 1 127.0.0.1:6379> BF.EXISTS bf:items item:1001 (integer) 1 127.0.0.1:6379> BF.EXISTS bf:items item:99999999 (integer) 0
That 0 is a definite answer: item 99999999 was never added. This lesson shows how that property protects a database from requests for data that does not exist, and how it combines with a simpler technique, negative caching
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%