diff options
author | andy <andy@whiskeymedia.com> | 2012-10-07 22:14:35 -0700 |
---|---|---|
committer | andy <andy@whiskeymedia.com> | 2012-10-07 22:14:35 -0700 |
commit | e85056eb37cbc3289c8ab321af38f04e58882e80 (patch) | |
tree | 42125bcb58d5fb16d02790939b1628b2da2d9f34 | |
parent | a8426648791deab1927adbb7b29478f91a18e99b (diff) | |
parent | 406704597eb7cef2a69f443a7afc66f65a75d316 (diff) | |
download | redis-py-e85056eb37cbc3289c8ab321af38f04e58882e80.tar.gz |
Merge branch 'master' of github.com:andymccurdy/redis-py
-rw-r--r-- | redis/client.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/redis/client.py b/redis/client.py index 53aa286..45bc50f 100644 --- a/redis/client.py +++ b/redis/client.py @@ -179,6 +179,7 @@ class StrictRedis(object): 'SUNIONSTORE ZADD ZCARD ZREMRANGEBYRANK ZREMRANGEBYSCORE', int ), + string_keys_to_dict('INCRBYFLOAT HINCRBYFLOAT', float), string_keys_to_dict( # these return OK, or int if redis-server is >=1.3.4 'LPUSH RPUSH', @@ -556,6 +557,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) @@ -1201,6 +1209,12 @@ class StrictRedis(object): "Increment the value of ``key`` in hash ``name`` by ``amount``" return self.execute_command('HINCRBY', name, key, amount) + def hincrbyfloat(self, name, key, amount=1.0): + """ + Increment the value of ``key`` in hash ``name`` by floating ``amount`` + """ + return self.execute_command('HINCRBYFLOAT', name, key, amount) + def hkeys(self, name): "Return the list of keys within hash ``name``" return self.execute_command('HKEYS', name) |