diff options
author | Nikita Uvarov <uv.nikita@gmail.com> | 2012-08-21 11:26:13 +0300 |
---|---|---|
committer | Nikita Uvarov <uv.nikita@gmail.com> | 2012-08-21 11:26:13 +0300 |
commit | 96b1011f067b7a627ce5ed2c07f2fda03690b2bc (patch) | |
tree | 3f43fbd7b83dc5044c2952d68e80cdf275d2c6c2 /redis/client.py | |
parent | fd82c5d6cdcc2596b6cf5a0e053658b4c78ee867 (diff) | |
download | redis-py-96b1011f067b7a627ce5ed2c07f2fda03690b2bc.tar.gz |
Implemented incrbyfloat command
Diffstat (limited to 'redis/client.py')
-rw-r--r-- | redis/client.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/redis/client.py b/redis/client.py index d475ae3..c7ea3b1 100644 --- a/redis/client.py +++ b/redis/client.py @@ -169,6 +169,7 @@ class StrictRedis(object): 'SUNIONSTORE ZADD ZCARD ZREMRANGEBYRANK ZREMRANGEBYSCORE', int ), + string_keys_to_dict('INCRBYFLOAT', float), string_keys_to_dict( # these return OK, or int if redis-server is >=1.3.4 'LPUSH RPUSH', @@ -545,6 +546,13 @@ class StrictRedis(object): """ return self.execute_command('INCRBY', name, amount) + def incrbyfloat(self, name, amount=1.0): + """ + Increments the value at key ``name`` by floating ``amount``. + If no key exists, the value will be initialized as ``amount`` + """ + return self.execute_command('INCRBYFLOAT', name, amount) + def keys(self, pattern='*'): "Returns a list of keys matching ``pattern``" return self.execute_command('KEYS', pattern) |