TOPK.ADD

Syntax
TOPK.ADD key items [items ...]
Available in:
Redis Stack / Bloom 2.0.0
Time complexity:
O(n * k) where n is the number of items and k is the depth

向数据结构中添加一个项目。 可以一次性添加多个项目。 如果一个项目进入Top-K列表,被排出的项目将被返回。 这允许动态检测进入或退出Top-K列表的项目。

参数

  • key: 添加项目的草图名称。
  • item: 要添加的项目。

返回

Array replySimple string reply - 如果从 TopK 列表中删除了一个元素,则为 Nil reply,否则为其他情况。

示例

redis> TOPK.ADD topk foo bar 42
1) (nil)
2) baz
3) (nil)

RATE THIS PAGE
Back to top ↑