Removes and returns a random element from the set value stored at key
.
This operation is similar to SRANDMEMBER, that returns a random element from a set but does not remove it.
返回值
Bulk string reply: the removed element, or nil
when key
does not exist.
例子
redis>
SADD myset "one"
(integer) 1redis> SADD myset "two"
(integer) 1redis> SADD myset "three"
(integer) 1redis> SPOP myset
"one"redis> SMEMBERS myset
1) "three" 2) "two"