diff options
author | Andy McCurdy <andy@andymccurdy.com> | 2010-03-10 13:34:03 -0800 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2010-03-10 13:34:03 -0800 |
commit | 9e3e1aa43456202e86e241955f3ae7f5220f5d58 (patch) | |
tree | 3971bc5e41af62ac61ee1252bf656fde35c62c82 /redis/client.py | |
parent | c83542e58593fd0ce6347f399b65763abfebcccb (diff) | |
download | redis-py-9e3e1aa43456202e86e241955f3ae7f5220f5d58.tar.gz |
added HGET/HSET commands
removed the KEYS callback -- 1.34 Redis servers now return KEYS with the multi-bulk protocol, which means they're already in a list
Diffstat (limited to 'redis/client.py')
-rw-r--r-- | redis/client.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/redis/client.py b/redis/client.py index a2897d9..d2e3e77 100644 --- a/redis/client.py +++ b/redis/client.py @@ -182,7 +182,6 @@ class Redis(threading.local): { 'BGSAVE': lambda r: r == 'Background saving started', 'INFO': parse_info, - 'KEYS': lambda r: r and r.split(' ') or [], 'LASTSAVE': timestamp_to_datetime, 'PING': lambda r: r == 'PONG', 'RANDOMKEY': lambda r: r and r or None, @@ -868,6 +867,16 @@ class Redis(threading.local): return self.format_bulk('ZSCORE', name, value) + #### HASH COMMANDS #### + def hget(self, name, key): + "Return the value of ``key`` within the hash ``name``" + return self.format_bulk('HGET', name, key) + + def hset(self, name, key, value): + "Set ``key`` to ``value`` within hash ``name``" + return self.format_multi_bulk('HSET', name, key, value) + + class Pipeline(Redis): """ Pipelines provide a way to transmit multiple commands to the Redis server |