Redis Set SREM Command
The Redis SREM
command removes one or more members from a set. Non-existent members are ignored.
An error is returned if the key is not of set type.
Syntax
The basic syntax of the SREM
command is as follows:
1 | SREM key member [member ...] |
In Redis version 2.4 and earlier, SREM
only accepted a single member value.
Available Since
Redis version >= 1.0.0
Time Complexity
O(N) where N is the number of members to be removed.
ACL Categories
@write
, @set
, @fast
Return Value
Returns the number of members that were removed from the set, not including non existing members.
Example
1 | 127.0.0.1:6379> SADD myset a b c d e |
All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.