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.EXISTS

Last updated
BF.EXISTS key item
Group
Bloom filter
Complexity
O(k), k being the number of hash functions
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.EXISTS tells you whether item may be in the Bloom filter at key. A 0 is certain: the item was never added. A 1 means it was probably added; the chance of a wrong 1 is about the filter’s error rate.

Case RESP2 RESP3
Item may be present Integer 1 Boolean true
Item not present Integer 0 Boolean false
Key does not exist Integer 0 Boolean false

A key that holds another type also replies 0, not WRONGTYPE.

127.0.0.1:6379> BF.ADD visitors alice
(integer) 1
127.0.0.1:6379> BF.EXISTS visitors alice
(integer) 1
127.0.0.1:6379> BF.EXISTS visitors bob
(integer) 0
127.0.0.1:6379> BF.EXISTS nosuchfilter alice
(integer) 0

Same as BF.EXISTS in RedisBloom for Bloom filter keys and missing keys.

BF.MEXISTS, BF.ADD, BF.CARD