diff options
author | Derek Hu <derek.dchu@gmail.com> | 2015-01-07 23:32:39 -0500 |
---|---|---|
committer | Derek Hu <derek.dchu@gmail.com> | 2015-01-07 23:32:39 -0500 |
commit | f07f876543041b80ae3d27c434b3b9c36cf80075 (patch) | |
tree | b1494736d297334d9f44294ea3c7dc6fbf8951fd | |
parent | cee81bd7ea1c4c5f00ac91b8d70b10eccd31dd0c (diff) | |
download | redis-py-f07f876543041b80ae3d27c434b3b9c36cf80075.tar.gz |
add 'decrby' method
-rwxr-xr-x | redis/client.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/redis/client.py b/redis/client.py index c99b817..3acfb9f 100755 --- a/redis/client.py +++ b/redis/client.py @@ -824,6 +824,16 @@ class StrictRedis(object): """ return self.execute_command('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) + def delete(self, *names): "Delete one or more keys specified by ``names``" return self.execute_command('DEL', *names) |