SPOP key
相关命令
- SADD
- SCARD
- SDIFF
- SDIFFSTORE
- SINTER
- SINTERSTORE
- SISMEMBER
- SMEMBERS
- SMOVE
- SPOP
- SRANDMEMBER
- SREM
- SSCAN
- SUNION
- SUNIONSTORE
始于1.0.0可用。
时间复杂度: O(1)
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) 1
redis> SADD myset "two"
- (integer) 1
redis> SADD myset "three"
- (integer) 1
redis> SPOP myset
- "one"
redis> SMEMBERS myset
- 1) "three"
- 2) "two"
This website is open source software developed by Citrusbyte.
The Redis logo was designed by Carlos Prioglio. See more credits.