The bloom filter module provides four specific data types:
- Count-min sketch
Bloom and Cuckoo Filters
Bloom and cuckoo filters mainly determine if an element is a set member. They are extremely fast and efficient.
Top-K data structure is used to keep track of the list of the most frequently seen items.
On the other hand, the count-min sketch data structure determines the frequency of events. Using this type, you can determine the frequency estimate of a given event.
Redis Install Bloom Filter Module
Before using the Reids Bloom Filter module, you must compile and load it.
Start by cloning the source repository:
Once the operation is complete, navigate into the repository directory:
Compile module by running the command:
Ensure you have the required dependencies for successful compilation.
Edit the Redis configuration file and load the module:
You can also load the module from the command line as:
Redis Create Bloom Filter
You can create a new bloom filter by adding a new item as shown in the command below:
The command above should add a new bloom filter with the name databases and one item.
To add multiple items to a bloom filter, use the MADD command as shown:
1) (integer) 1
2) (integer) 1
3) (integer) 1
Check if an item exists
To check if an item exists within a bloom filter, run the command:
Since a bloom filter is a probabilistic data structure, the output indicates a probability the item exists.
If the output is 0, the item does not exist.
You can also check if multiple items exist in the bloom filter using the MEXISTS command.
1) (integer) 1
2) (integer) 0
This guide covered installing and using the Redis Bloom filter module.
Thanks for reading!!