BF.ADD

BF.ADD key item
Available in:
Redis Open Source / Bloom 1.0.0
Time complexity:
O(k), where k is the number of hash functions used by the last sub-filter
ACL categories:
@bloom, @write, @slow,
Compatibility:
Redis Software and Redis Cloud compatibility

Adds an item to a Bloom filter.

This command is similar to BF.MADD, except that only one item can be added.

Required arguments

key

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

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

item

is an item to add.

Examples

BF.ADD bf item1 BF.ADD bf item1

Redis Software and Redis Cloud compatibility

Redis
Software
Redis
Cloud
Notes
✅ Supported
✅ Flexible & Annual
✅ Free & Fixed

Return information

One of the following:

  • Integer reply: 1 for successfully adding an item, or 0 if there's a probability that the item was already added to the filter.
  • Simple error reply in these cases: invalid arguments, wrong key type, or when the filter is full.
RATE THIS PAGE
Back to top ↑