BF.EXISTS
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.
Return value
Section titled “Return value”| 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.
Examples
Section titled “Examples”127.0.0.1:6379> BF.ADD visitors alice(integer) 1127.0.0.1:6379> BF.EXISTS visitors alice(integer) 1127.0.0.1:6379> BF.EXISTS visitors bob(integer) 0127.0.0.1:6379> BF.EXISTS nosuchfilter alice(integer) 0Compatibility
Section titled “Compatibility”Same as BF.EXISTS in RedisBloom for Bloom filter keys and missing keys.
See also
Section titled “See also”Was this helpful?
Thanks for the feedback.