summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Dorosz <cypreess@gmail.com>2013-04-28 11:24:00 +0200
committerKrzysztof Dorosz <cypreess@gmail.com>2013-04-28 11:24:00 +0200
commitd082f0fe3985a36d6a5705d6fd3365a7d573d1f8 (patch)
tree1b730e3b4e4539443fddb0314a83ec01284d1b2d
parent07990bccb5969154cb1fc01fedf7265bb950e2d7 (diff)
downloadredis-py-d082f0fe3985a36d6a5705d6fd3365a7d573d1f8.tar.gz
Adding incrby alias
-rw-r--r--redis/client.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/redis/client.py b/redis/client.py
index 2964aa7..234b140 100644
--- a/redis/client.py
+++ b/redis/client.py
@@ -614,6 +614,16 @@ class StrictRedis(object):
"""
return self.execute_command('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)
+
def incrbyfloat(self, name, amount=1.0):
"""
Increments the value at key ``name`` by floating ``amount``.