summaryrefslogtreecommitdiff
path: root/redis
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2018-11-14 22:29:41 -0800
committerAndy McCurdy <andy@andymccurdy.com>2018-11-14 22:29:41 -0800
commit32a1a3f7ede2ee819d411c7ee011e818539e42e5 (patch)
tree84ca7f45fb3fbf3070e96338acbed0bfd1c51394 /redis
parent0bd66a9eb6ecdb96183f78d39a5173e931edb17c (diff)
downloadredis-py-32a1a3f7ede2ee819d411c7ee011e818539e42e5.tar.gz
saner handling of decr/incr vs decrby/incrby
Diffstat (limited to 'redis')
-rwxr-xr-xredis/client.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/redis/client.py b/redis/client.py
index 0383d14..49cb204 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -1152,17 +1152,16 @@ class Redis(object):
Decrements the value of ``key`` by ``amount``. If no key exists,
the value will be initialized as 0 - ``amount``
"""
- return self.execute_command('DECRBY', name, amount)
+ # An alias for ``decr()``, because it is already implemented
+ # as DECRBY redis command.
+ return self.decrby(name, amount)
def decrby(self, name, amount=1):
"""
Decrements the value of ``key`` by ``amount``. If no key exists,
the value will be initialized as 0 - ``amount``
"""
-
- # An alias for ``decr()``, because it is already implemented
- # as DECRBY redis command.
- return self.decr(name, amount)
+ return self.execute_command('DECRBY', name, amount)
def delete(self, *names):
"Delete one or more keys specified by ``names``"
@@ -1240,17 +1239,16 @@ class Redis(object):
Increments the value of ``key`` by ``amount``. If no key exists,
the value will be initialized as ``amount``
"""
- return self.execute_command('INCRBY', name, amount)
+ return self.incrby(name, amount)
def incrby(self, name, amount=1):
"""
Increments the value of ``key`` by ``amount``. If no key exists,
the value will be initialized as ``amount``
"""
-
# An alias for ``incr()``, because it is already implemented
# as INCRBY redis command.
- return self.incr(name, amount)
+ return self.execute_command('INCRBY', name, amount)
def incrbyfloat(self, name, amount=1.0):
"""