mirror of
https://github.com/redis/go-redis.git
synced 2025-06-14 01:21:30 +03:00
Merge pull request #156 from go-redis/fix/SRandMemberN
Add SRandMemberN. Fixes #155.
This commit is contained in:
@ -944,12 +944,20 @@ func (c *commandable) SPop(key string) *StringCmd {
|
||||
return cmd
|
||||
}
|
||||
|
||||
// Redis `SRANDMEMBER key` command.
|
||||
func (c *commandable) SRandMember(key string) *StringCmd {
|
||||
cmd := NewStringCmd("SRANDMEMBER", key)
|
||||
c.Process(cmd)
|
||||
return cmd
|
||||
}
|
||||
|
||||
// Redis `SRANDMEMBER key count` command.
|
||||
func (c *commandable) SRandMemberN(key string, count int64) *StringSliceCmd {
|
||||
cmd := NewStringSliceCmd("SRANDMEMBER", key, formatInt(count))
|
||||
c.Process(cmd)
|
||||
return cmd
|
||||
}
|
||||
|
||||
func (c *commandable) SRem(key string, members ...string) *IntCmd {
|
||||
args := make([]interface{}, 2+len(members))
|
||||
args[0] = "SREM"
|
||||
|
Reference in New Issue
Block a user