From a6da93713abbcc558cb4a23435f7d2108f9c2c5f Mon Sep 17 00:00:00 2001 From: Rich Hong Date: Wed, 23 Dec 2015 17:24:42 -0500 Subject: [PATCH] Support multiple keys for the PFCOUNT command --- commands.go | 9 +++++++-- commands_test.go | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/commands.go b/commands.go index d5350022..231d4721 100644 --- a/commands.go +++ b/commands.go @@ -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 } diff --git a/commands_test.go b/commands_test.go index 9796a37d..c592090a 100644 --- a/commands_test.go +++ b/commands_test.go @@ -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))) }) })