diff options
author | Konstantin Merenkov <kmerenkov@gmail.com> | 2010-04-12 18:53:56 +0800 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2010-04-13 01:19:18 +0800 |
commit | edcb36a33d59fb5575bac0996152013b726d61c8 (patch) | |
tree | 227e7c9a27789d8eb2cf7597ae36e680b50c88cc /redis/client.py | |
parent | 4dec96f235d3d1ef9fd1eb8a1549b75caae36c59 (diff) | |
download | redis-py-edcb36a33d59fb5575bac0996152013b726d61c8.tar.gz |
HMSET support
Diffstat (limited to 'redis/client.py')
-rw-r--r-- | redis/client.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/redis/client.py b/redis/client.py index 09a21fb..51986a0 100644 --- a/redis/client.py +++ b/redis/client.py @@ -190,7 +190,7 @@ class Redis(threading.local): """ RESPONSE_CALLBACKS = dict_merge( string_keys_to_dict( - 'AUTH DEL EXISTS EXPIRE HDEL HEXISTS MOVE MSETNX RENAMENX ' + 'AUTH DEL EXISTS EXPIRE HDEL HEXISTS HMSET MOVE MSETNX RENAMENX ' 'SADD SISMEMBER SMOVE SETNX SREM ZADD ZREM', bool ), @@ -1001,6 +1001,12 @@ class Redis(threading.local): """ return self.execute_command('HSET', name, key, value) + def hmset(self, key, mapping): + "Sets each key in the ``mapping`` dict to its corresponding value" + items = [] + [items.extend(pair) for pair in mapping.iteritems()] + return self.execute_command('HMSET', key, *items) + def hvals(self, name): "Return the list of values within hash ``name``" return self.execute_command('HVALS', name) |