ZREM key member
ZREM command in redis removes the specified member from the sorted set value stored at the key.
Note:
1. If a member was not a member of the set no operation is performed.
2. If the key does not hold a set value an error is returned.
TIME COMPLEXITY: O(log(N)) with N being the number of elements in the sorted set
RETURN VALUE: Integer reply, specifically:
1 if the new element was removed
0 if the new element was not a member of the set.
Syntax:
ZREM key member
Example 1: When the member is present
redis:6379> ZADD mykey 1 A 2 B 3 C 4 D 5 E(integer) 5redis:6379> ZREM mykey A(integer) 1
Output
1
Example 2: When the member is not present
redis:6379> ZADD mykey 1 A 2 B 3 C 4 D 5 E(integer) 5redis:6379> ZREM myKey AA(integer) 0
Output
0
No comments:
Post a Comment