BF.MADD

Syntax
BF.MADD key item [item ...]
Available in:
Redis Stack / Bloom 1.0.0
Time complexity:
O(k * n), where k is the number of hash functions and n is the number of items

Adds one or more items to a Bloom filter.

This command is similar to BF.ADD, except that you can add more than one item.

This command is similar to BF.INSERT, except that the error rate, capacity, and expansion cannot be specified.

Required arguments

key

is key name for a Bloom filter to add the items to.

If key does not exist - a new Bloom filter is created with default error rate, capacity, and expansion (see BF.RESERVE).

item...

One or more items to add.

Return value

Returns one of these replies:

  • Array reply where each element is either
    • Integer reply - where "1" means that the item has been added successfully, and "0" means that such item was already added to the filter (which could be wrong)
    • [] when the item cannot be added because the filter is full
  • [] on error (invalid arguments, wrong key type, etc.)

Examples

redis> BF.MADD bf item1 item2 item2
1) (integer) 1
2) (integer) 1
3) (integer) 0

Rate this page