ZREM

Syntax
ZREM key member [member ...]
Available since:
1.2.0
Time complexity:
O(M*log(N)) with N being the number of elements in the sorted set and M the number of elements to be removed.
ACL categories:
@write, @sortedset, @fast,

从存储在key的有序集合中移除指定的成员。不存在的成员将被忽略。

key存在且不持有排序集合时,将返回错误。

示例

ZADD myzset 1 "one" ZADD myzset 2 "two" ZADD myzset 3 "three" ZREM myzset "two" ZRANGE myzset 0 -1 WITHSCORES

RESP2/RESP3 回复

Integer reply: the number of members removed from the sorted set, not including non-existing members.

历史

  • 从 Redis 2.4.0 版本开始:接受多个元素。
RATE THIS PAGE
Back to top ↑