Redis srem 命令
SREM key member [member …]
Remove the specified members from the set stored at
key. Specified members that are not a member of this set are ignored. If
key does not exist, it is treated as an empty set and this command returns
An error is returned when the value stored at
key is not a set.
Integer reply: the number of members that were removed from the set, not including non existing members.
>= 2.4: Accepts multiple
memberarguments. Redis versions older than 2.4 can only remove a set member per call.
(integer) 1redis> SADD myset “two”
(integer) 1redis> SADD myset “three”
(integer) 1redis> SREM myset “one”
(integer) 1redis> SREM myset “four”
(integer) 0redis> SMEMBERS myset
1) "three" 2) "two"redis>