Skip to content

Commit

Permalink
Support multiple keys for the PFCOUNT command
Browse files Browse the repository at this point in the history
  • Loading branch information
hongrich committed Dec 23, 2015
1 parent f6d6826 commit a6da937
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -1340,8 +1340,13 @@ func (c *commandable) PFAdd(key string, fields ...string) *IntCmd {
return cmd
}

func (c *commandable) PFCount(key string) *IntCmd {
cmd := NewIntCmd("PFCOUNT", key)
func (c *commandable) PFCount(keys ...string) *IntCmd {
args := make([]interface{}, 1+len(keys))
args[0] = "PFCOUNT"
for i, key := range keys {
args[1+i] = key
}
cmd := NewIntCmd(args...)
c.Process(cmd)
return cmd
}
Expand Down
4 changes: 4 additions & 0 deletions commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,10 @@ var _ = Describe("Commands", func() {
pfCount = client.PFCount("hllMerged")
Expect(pfCount.Err()).NotTo(HaveOccurred())
Expect(pfCount.Val()).To(Equal(int64(10)))

pfCount = client.PFCount("hll1", "hll2")
Expect(pfCount.Err()).NotTo(HaveOccurred())
Expect(pfCount.Val()).To(Equal(int64(10)))
})
})

Expand Down

0 comments on commit a6da937

Please sign in to comment.