BF.EXISTS

Syntax
BF.EXISTS key item
Available in:
Redis Stack / Bloom 1.0.0
Time complexity:
O(k), where k is the number of hash functions used by the last sub-filter

确定给定的项目是否已添加到布隆过滤器中。

此命令类似于BF.MEXISTS,不同之处在于只能检查一个项目。

必需的参数

key

是布隆过滤器的键名。

item

是一个需要检查的项目。

返回值

返回以下回复之一:

  • Integer reply,其中 1 表示很有可能 item 已经被添加到过滤器中,而 0 表示 key 不存在或 item 尚未被添加到过滤器中。
  • [] 出错时(无效参数,错误的键类型等)

示例

redis> BF.ADD bf item1
(integer) 1
redis> BF.EXISTS bf item1
(integer) 1
redis> BF.EXISTS bf item2
(integer) 0

RATE THIS PAGE
Back to top ↑