rem
UK[ˌɑ:r i: ˈem] US[ˌɑ:ri:'em]
n.DOS command: Specify commands ignored by DOS OK; (sleep)
of rapid eye movementsredis ZREM command syntax
Function:Remove one or more members from the ordered set key. Non-existing members will be ignored. When key exists but is not an ordered set type, an error is returned.
Syntax: ZREM key member [member ...]
Available versions: >= 1.2.0
Time complexity: O(M*log(N)), N is the cardinality of the ordered set, M is the number of successfully removed members.
Returns: The number of successfully removed members, excluding ignored members.
redis ZREM command example
# 测试数据 redis> ZRANGE page_rank 0 -1 WITHSCORES 1) "bing.com" 2) "8" 3) "baidu.com" 4) "9" 5) "google.com" 6) "10" # 移除单个元素 redis> ZREM page_rank google.com (integer) 1 redis> ZRANGE page_rank 0 -1 WITHSCORES 1) "bing.com" 2) "8" 3) "baidu.com" 4) "9" # 移除多个元素 redis> ZREM page_rank baidu.com bing.com (integer) 2 redis> ZRANGE page_rank 0 -1 WITHSCORES (empty list or set) # 移除不存在元素 redis> ZREM page_rank non-exists-element (integer) 0