This is a port of the dablooms library - a scalable, counting, Bloom filter by Justin Hines at Bitly - to a Redis module.
For background, refer to the original README.
redablooms provides all of dabloom's functionality, but stores the data structures in Redis Strings instead of files. Additionally, redablooms provides an automatic means for generating element ids using a sequence or server clock with rounding.
make
--loadmodule /path/to/module.so
option, add it as a directive to the configuration file or send a MODULE LOAD
command.SBF.ADD key elem id [elem id ...]
Adds one or more elements and their ids to the filter in key
.
If key
doesn't exist, the filter is created with the default capacity (100000) and error rate (0.05).
Elements' id
s are always integers, but can be provided in one of the following ways:
Notes about adding multiple elements in a single call:
Reply: Integer, the filter's current maximum id.
SBF.REM key elem id [elem id ...]
Removes elements by id from the filter. id
s must be only 'n', '/n' or '+0'.
Reply: Integer, the number of elements removed.
SBF.CHECK key elem
Checks if elem
exists in key
.
Reply: Integer, 1 if the element exists, 0 otherwise.
SBF.INIT key capacity error-rate
Initializes a new scaling counting Bloom filter.
Use this to specify other-than-the-default capacity and error rate for the filter.
Reply: String, "OK".
SBF.DEBUG key
Shows the filter's meta data.
Reply: Array.
CBF.ADD key elem [elem ...]
Adds one or more elements the filter in key
.
If the key doesn't exist, the filter is created with the default capacity (100000) and error rate (0.05).
Reply: Integer, the count of elements in the filter.
CBF.REM key elem [elem ...]
Removes elements from the filter.
Reply: Integer, the count of elements in the filter.
CBF.CHECK key elem
Checks if elem
exists in key
.
Reply: Integer, 1 if the element exists, 0 otherwise.
CBF.INIT key capacity error-rate
Initializes a new counting Bloom filter.
Use this to specify other-than-the-default capacity and error rate for the filter.
Reply: String, "OK".
CBF.DEBUG key
Shows the filter's meta data.
Reply: Array.
Issue reports, pull and feature requests are welcome.
redablooms is licensed under AGPLv3 - see LICENSE.
deblooms is licensed under a very liberal license - see LICENSE-dablooms.