What's new in Valkey 9.0? Discover new features and improvements. Read the announcement.

BF.MADD

Adds one or more items to a bloom filter. The bloom filter is created if it doesn't exist

Usage
BF.MADD key value ...
Complexity
O(N * K), where N is the number of hash functions used by the bloom filter and K is the number of items being added
Module
valkey-bloom
Since module version
1.0.0
ACL Categories
@fast, @write, @bloom

Adds one or more items to a bloom filter. If the specified bloom filter does not exist, a bloom filter is created with the provided name with default properties.

If you want to create a bloom filter with non-default properties, use the BF.INSERT or BF.RESERVE command.

Examples

127.0.0.1:6379> BF.MADD key item1 item2
1) (integer) 1
2) (integer) 1
127.0.0.1:6379> BF.MADD key item2 item3
1) (integer) 0
2) (integer) 1
127.0.0.1:6379> BF.MADD key_new item1
1) (integer) 1

Replies

RESP2

Array reply: Array of ints (1’s and 0’s)

An error will occur if input is invalid, if a non bloom filter key with the same name already exists, if the bloom filter creation / scale out exceeds limits, or if an item is being added to a full non scaling filter.

RESP3

Array reply: Array of ints (1’s and 0’s)

An error will occur if input is invalid, if a non bloom filter key with the same name already exists, if the bloom filter creation / scale out exceeds limits, or if an item is being added to a full non scaling filter.