diff options
author | Andy McCurdy <andy@andymccurdy.com> | 2018-11-14 22:24:49 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-14 22:24:49 -0800 |
commit | 0bd66a9eb6ecdb96183f78d39a5173e931edb17c (patch) | |
tree | 740afde5caf758fb57afb042ce905d649e90c4a0 | |
parent | 35640aa31a70fe9eaf07512c69a601533fed130f (diff) | |
parent | f07f876543041b80ae3d27c434b3b9c36cf80075 (diff) | |
download | redis-py-0bd66a9eb6ecdb96183f78d39a5173e931edb17c.tar.gz |
Merge pull request #578 from derek-dchu/master
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 0a46ce2..0383d14 100755 --- a/redis/client.py +++ b/redis/client.py @@ -1154,6 +1154,16 @@ class Redis(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) |