summaryrefslogtreecommitdiff
path: root/redis/client.py
diff options
context:
space:
mode:
authorZak Johnson <zakj@nox.cx>2010-03-03 07:03:00 +0800
committerAndy McCurdy <andy@andymccurdy.com>2010-03-03 07:15:11 +0800
commit361cea3444f8661ee0f08074a1dbc5c484eb2326 (patch)
tree4a00187921f04e5a9eee63e1dbe2a8501a74fa87 /redis/client.py
parentc1e762849f52c2ec1f66bf0a7c1ce4d9a1ee7153 (diff)
downloadredis-py-361cea3444f8661ee0f08074a1dbc5c484eb2326.tar.gz
Add Redis.__contains__ to support "'key' in redis"
Diffstat (limited to 'redis/client.py')
-rw-r--r--redis/client.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/redis/client.py b/redis/client.py
index 590348f..0679b99 100644
--- a/redis/client.py
+++ b/redis/client.py
@@ -409,6 +409,7 @@ class Redis(object):
def exists(self, name):
"Returns a boolean indicating whether key ``name`` exists"
return self.format_inline('EXISTS', name)
+ __contains__ = exists
def expire(self, name, time):
"Set an expire on key ``name`` for ``time`` seconds"
@@ -921,4 +922,4 @@ class Pipeline(Redis):
def select(self, host, port, db):
raise RedisError("Cannot select a different database from a pipeline")
- \ No newline at end of file
+