Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

BF.MADD

Last updated
BF.MADD key item [item ...]
Group
Bloom filter
Complexity
O(k * n), k hash functions and n items
Arity
-1 (at least 1 words, counting the command name)
Flags
none
Keys
first 1, last 1, step 1
HotKV Cloud
All plans
On-Premise
no license needed

BF.MADD adds each item to the Bloom filter at key, in order, and reports for each one whether it was new. If the key does not exist, a filter is created first with capacity 100, error rate 0.01 and expansion 2.

An array with one element per item:

Element RESP2 RESP3
Item added Integer 1 Boolean true
Item (probably) already present Integer 0 Boolean false

If an item cannot be added (a full non-scaling filter, or no memory to grow), the array ends with that error in place of the item’s reply, and the items after it are not tried. For example a non-scaling filter that fills up mid-call replies with 1 for the items that fit and then ERR non scaling filter is full.

WRONGTYPE if the key holds another type (as the whole reply).

127.0.0.1:6379> BF.MADD tags red green red
1) (integer) 1
2) (integer) 1
3) (integer) 0
127.0.0.1:6379> BF.RESERVE tiny 0.000001 2 NONSCALING
OK
127.0.0.1:6379> BF.MADD tiny a b c d
1) (integer) 1
2) (integer) 1
3) (error) ERR non scaling filter is full

Same as BF.MADD in RedisBloom.

BF.ADD, BF.INSERT, BF.MEXISTS