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

Implemented PFADD, PFCOUNT, PFMERGE

This commit is contained in:
Cosmin Luță
2015-11-04 09:34:58 +02:00
parent 05394bee7c
commit 43603e1ea4
2 changed files with 53 additions and 0 deletions

View File

@ -1332,6 +1332,38 @@ func (c *commandable) ZUnionStore(dest string, store ZStore, keys ...string) *In
//------------------------------------------------------------------------------
func (c *commandable) PFAdd(key string, fields ...string) *IntCmd {
args := make([]interface{}, 2+len(fields))
args[0] = "PFADD"
args[1] = key
for i, field := range fields {
args[2+i] = field
}
cmd := NewIntCmd(args...)
c.Process(cmd)
return cmd
}
func (c *commandable) PFCount(key string) *IntCmd {
cmd := NewIntCmd("PFCOUNT", key)
c.Process(cmd)
return cmd
}
func (c *commandable) PFMerge(dest string, keys ...string) *StatusCmd {
args := make([]interface{}, 2+len(keys))
args[0] = "PFMERGE"
args[1] = dest
for i, key := range keys {
args[2+i] = key
}
cmd := NewStatusCmd(args...)
c.Process(cmd)
return cmd
}
//------------------------------------------------------------------------------
func (c *commandable) BgRewriteAOF() *StatusCmd {
cmd := NewStatusCmd("BGREWRITEAOF")
cmd._clusterKeyPos = 0