ZDIFFSTORE

语法
ZDIFFSTORE destination numkeys key [key ...]
自版本
6.2.0
时间复杂度
最坏情况下为 O(L + (N-K)log(N)),其中 L 是所有集合中元素的总数,N 是第一个集合的大小,K 是结果集合的大小。
ACL 类别
@write, @sortedset, @slow,

计算第一个和所有后续输入有序集合之间的差集,并将结果存储在 destination 中。输入键的总数由 numkeys 指定。

不存在的键被视为空集。

如果 destination 已经存在,它将被覆盖。

示例

ZADD zset1 1 "one" ZADD zset1 2 "two" ZADD zset1 3 "three" ZADD zset2 1 "one" ZADD zset2 2 "two" ZDIFFSTORE out 2 zset1 zset2 ZRANGE out 0 -1 WITHSCORES

RESP2/RESP3 回复

整数回复: 结果有序集合在 destination 中的成员数量。
RATE THIS PAGE
Back to top ↑