Redis

SPOP key

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.

Return value

Bulk string reply: the removed element, or nil when key does not exist.

Examples

redis>  SADD myset "one"
(integer) 1
redis>  SADD myset "two"
(integer) 1
redis>  SADD myset "three"
(integer) 1
redis>  SPOP myset
"three"
redis>  SMEMBERS myset
1) "two"
2) "one"
redis> 
Comments powered by Disqus