From 4cbe497190412f1b3e95ecc14b8652486a9b92dd Mon Sep 17 00:00:00 2001 From: Eyal Post Date: Fri, 10 Feb 2017 00:32:52 +0200 Subject: [PATCH] ObjectRefCount and ObjectEncoding accept one key --- commands.go | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/commands.go b/commands.go index f346c17..77384cb 100644 --- a/commands.go +++ b/commands.go @@ -55,8 +55,8 @@ type Cmdable interface { Keys(pattern string) *StringSliceCmd Migrate(host, port, key string, db int64, timeout time.Duration) *StatusCmd Move(key string, db int64) *BoolCmd - ObjectRefCount(keys ...string) *IntCmd - ObjectEncoding(keys ...string) *StringCmd + ObjectRefCount(key string) *IntCmd + ObjectEncoding(key string) *StringCmd ObjectIdleTime(key string) *DurationCmd Persist(key string) *BoolCmd PExpire(key string, expiration time.Duration) *BoolCmd @@ -355,26 +355,14 @@ func (c *cmdable) Move(key string, db int64) *BoolCmd { return cmd } -func (c *cmdable) ObjectRefCount(keys ...string) *IntCmd { - args := make([]interface{}, 2+len(keys)) - args[0] = "object" - args[1] = "refcount" - for i, key := range keys { - args[2+i] = key - } - cmd := NewIntCmd(args...) +func (c *cmdable) ObjectRefCount(key string) *IntCmd { + cmd := NewIntCmd("object", "refcount", key) c.process(cmd) return cmd } -func (c *cmdable) ObjectEncoding(keys ...string) *StringCmd { - args := make([]interface{}, 2+len(keys)) - args[0] = "object" - args[1] = "encoding" - for i, key := range keys { - args[2+i] = key - } - cmd := NewStringCmd(args...) +func (c *cmdable) ObjectEncoding(key string) *StringCmd { + cmd := NewStringCmd("object", "encoding", key) c.process(cmd) return cmd }