1
0
mirror of https://github.com/redis/go-redis.git synced 2025-06-12 14:21:52 +03:00

add support for SPOP with a count argument (available in REDIS 3.2)

This commit is contained in:
Mattias Lundell
2016-06-09 17:39:51 +02:00
committed by Vladimir Mihailenco
parent 8964a568f3
commit cd582ed576
2 changed files with 36 additions and 0 deletions

View File

@ -946,12 +946,20 @@ func (c cmdable) SMove(source, destination string, member interface{}) *BoolCmd
return cmd
}
// Redis `SPOP key` command.
func (c cmdable) SPop(key string) *StringCmd {
cmd := NewStringCmd("spop", key)
c.process(cmd)
return cmd
}
// Redis `SPOP key count` command.
func (c cmdable) SPopN(key string, count int64) *StringSliceCmd {
cmd := NewStringSliceCmd("spop", key, count)
c.process(cmd)
return cmd
}
// Redis `SRANDMEMBER key` command.
func (c cmdable) SRandMember(key string) *StringCmd {
cmd := NewStringCmd("srandmember", key)