From 0f1856b7fc87ed49e86b98b310c93d0876a1697a Mon Sep 17 00:00:00 2001 From: siddontang Date: Thu, 15 May 2014 20:48:38 +0800 Subject: [PATCH] update kv decr --- ledis/cmd_kv.go | 2 +- ledis/t_kv.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ledis/cmd_kv.go b/ledis/cmd_kv.go index 754fb95..877b5b5 100644 --- a/ledis/cmd_kv.go +++ b/ledis/cmd_kv.go @@ -137,7 +137,7 @@ func decrbyCommand(c *client) error { return err } - if n, err := c.db.DecrBy(c.args[0], -delta); err != nil { + if n, err := c.db.DecrBy(c.args[0], delta); err != nil { return err } else { c.writeInteger(n) diff --git a/ledis/t_kv.go b/ledis/t_kv.go index bf273fb..b4c27f9 100644 --- a/ledis/t_kv.go +++ b/ledis/t_kv.go @@ -51,7 +51,7 @@ func (db *DB) Decr(key []byte) (int64, error) { } func (db *DB) DecrBy(key []byte, decrement int64) (int64, error) { - return db.incr(key, decrement) + return db.incr(key, -decrement) } func (db *DB) Del(keys [][]byte) (int64, error) {