Learn R Programming

rredis (version 1.6.9)

redisSPop: Remove and return an element from a set.

Description

Remove and return an element, chosen at random, from the specified set.

Usage

redisSPop(set, ...)

Arguments

set
The set name (character).
...
Optional additional arguments. Specify raw=TRUE to skip de-serialization of the data.

Value

  • A random element of the set, or NULL if the set is empty or does not exist.

References

http://redis.io/commands

See Also

redisSAdd

Examples

Run this code
redisConnect()
redisSAdd('set',runif(2))
redisSAdd('set',runif(3))
redisSAdd('set',runif(4))
redisSPop('set')
redisSPop('set')
redisSPop('set')
redisSPop('set')

Run the code above in your browser using DataLab