This module provides a scalable bloom filter as a Redis data type. Bloom filters are probabilistic data structures that do a very good job of quickly determining if something is contained within a set.
In order to use this module, build it using make
and load it into Redis.
Invoking redis with the module loaded
$ redis-server --loadmodule /path/to/rebloom.so
Adding items to filter
127.0.0.1:6379> BF.MADD bf foo bar baz
1) (integer) 1
2) (integer) 1
3) (integer) 1
Checking if items exist
127.0.0.1:6379> BF.MEXISTS bf foo nonexist 3
1) (integer) 1
2) (integer) 0
3) (integer) 0
You can find a command reference in docs/Commands.md
You can adjust the default error ratio and the initial filter size using
the ERROR_RATE
and INITIAL_SIZE
options respectively when loading the
module, e.g.:
$ redis-server --loadmodule /path/to/rebloom.so INITIAL_SIZE 400 ERROR_RATE 0.004
The default error rate is 0.01
and the default initial capacity is 100
.