What is a Bloom filter, and what problem does the RedisBloom module help you solve?
Short answer
A Bloom filter is a highly memory efficient probabilistic data structure that can quickly tell you whether an item is definitely not in a set or possibly in a set, and RedisBloom adds this capability to Redis, letting you check for likely membership in a very large collection…
Advertisement
AModel answer
A Bloom filter is a highly memory efficient probabilistic data structure that can quickly tell you whether an item is definitely not in a set or possibly in a set, and RedisBloom adds this capability to Redis, letting you check for likely membership in a very large collection using far less memory than storing every actual item.
Example
BF.ADD my_filter 'user123' BF.EXISTS my_filter 'user123'
Real-world example
A web crawler uses a Bloom filter to quickly check whether it has already visited a specific URL before, avoiding the need to store and search through billions of actual URL strings just to prevent revisiting the same pages.
Likely follow-ups
- What does it mean for a Bloom filter to have false positives but never false negatives?
- How much memory does a Bloom filter typically save compared to storing actual items?
Related topics