Module Hub Beta


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’ ids are always integers, but can be provided in one of the following ways:

  • An unsigned integer ‘n’ means the literal numeric id ‘n’.
  • ‘+[n]’ means incrementing the filter’s current maximum id by ‘n’ and using that value. By default ‘n’ is 1, so you can simply use the ‘+’ sign for the default increment. You can use ‘+0’ to use the current maximum id without incrementing it.
  • ‘/[n]’ means the server’s clock in milliseconds, divided by ‘n’, floored and multiplied by ‘n’. By default ‘n’ is 1. This is useful for generating ids based on resolutions other than milliseconds, e.g. ‘/1000’ will provide second resolutions ids, ‘/60000’ is for minute resolution, etc.

Notes about adding multiple elements in a single call:

  • The clock is sampled once per call.
  • max_id may may be updated once, otherwise an error is returned.

Return Value

Integer¬†reply: the filter’s current maximum id.


redis> SBF.ADD bloom foo +0
(integer) 0
redis> SBF.ADD bloom bar +0
(integer) 0
redis> SBF.CHECK bloom foo
(integer) 1
redis> SBF.CHECK bloom bar
(integer) 1
redis> SBF.CHECK bloom baz
(integer) 0

© 2017 Redis Labs, Inc. All rights reserved.