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

BF.ADD

Add a single item to a bloom filter. The bloom filter is created if it doesn't exist

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

Adds a single item to a bloom filter. If the specified bloom filter does not exist, a bloom filter is created with the provided name with default properties.

To add multiple items to a bloom filter, you can use the BF.MADD or BF.INSERT commands.

To create a bloom filter with non-default properties, use the BF.INSERT or BF.RESERVE command.

Examples

127.0.0.1:6379> BF.ADD key val
(integer) 1
127.0.0.1:6379> BF.ADD key val
(integer) 0

Replies

RESP2

One of the following:

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

One of the following:

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.