summaryrefslogtreecommitdiff
path: root/django/core/cache
diff options
context:
space:
mode:
authorJeremy Dunck <jdunck@gmail.com>2007-06-18 16:48:27 +0000
committerJeremy Dunck <jdunck@gmail.com>2007-06-18 16:48:27 +0000
commitbdcc95e5cce2754d78055f86d561ba2be92ba854 (patch)
tree08a7e4c86244cb42fe577aec5c03a57b023822c2 /django/core/cache
parent48c9f87e1f3ba9523d79c09f52c0ccc6221f08bf (diff)
gis: Merged revisions 4786-5490 via svnmerge from
http://code.djangoproject.com/svn/django/trunk git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@5492 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core/cache')
-rw-r--r--django/core/cache/backends/base.py3
-rw-r--r--django/core/cache/backends/memcached.py7
-rw-r--r--django/core/cache/backends/simple.py2
3 files changed, 9 insertions, 3 deletions
diff --git a/django/core/cache/backends/base.py b/django/core/cache/backends/base.py
index ef5f6a6b3e..bb67399f3b 100644
--- a/django/core/cache/backends/base.py
+++ b/django/core/cache/backends/base.py
@@ -54,3 +54,6 @@ class BaseCache(object):
Returns True if the key is in the cache and has not expired.
"""
return self.get(key) is not None
+
+ __contains__ = has_key
+
diff --git a/django/core/cache/backends/memcached.py b/django/core/cache/backends/memcached.py
index 180f95da73..1ab019221a 100644
--- a/django/core/cache/backends/memcached.py
+++ b/django/core/cache/backends/memcached.py
@@ -3,9 +3,12 @@
from django.core.cache.backends.base import BaseCache, InvalidCacheBackendError
try:
- import memcache
+ import cmemcache as memcache
except ImportError:
- raise InvalidCacheBackendError, "Memcached cache backend requires the 'memcache' library"
+ try:
+ import memcache
+ except:
+ raise InvalidCacheBackendError("Memcached cache backend requires either the 'memcache' or 'cmemcache' library")
class CacheClass(BaseCache):
def __init__(self, server, params):
diff --git a/django/core/cache/backends/simple.py b/django/core/cache/backends/simple.py
index 175944a75a..3fcad8c7ad 100644
--- a/django/core/cache/backends/simple.py
+++ b/django/core/cache/backends/simple.py
@@ -52,7 +52,7 @@ class CacheClass(BaseCache):
pass
def has_key(self, key):
- return self._cache.has_key(key)
+ return key in self._cache
def _cull(self):
if self._cull_frequency == 0: