summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2011-02-19 07:40:09 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2011-02-19 07:40:09 +0000
commit34662e7a301e651df6d8e7d978b0138c3dce76e4 (patch)
treeb6978d8bf10ef719fdad620a0d9affa55b91f1a6
parentf58dd619b84d2afb42f035f38f5fada75b6a815b (diff)
Fixed #15324 -- Modified the connection creation code for the memcache cache backend. Thanks to dlowe for the report and initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15567 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/core/cache/backends/memcached.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/core/cache/backends/memcached.py b/django/core/cache/backends/memcached.py
index 97d4317dec..a40416d90d 100644
--- a/django/core/cache/backends/memcached.py
+++ b/django/core/cache/backends/memcached.py
@@ -28,7 +28,10 @@ class BaseMemcachedCache(BaseCache):
"""
Implements transparent thread-safe access to a memcached client.
"""
- return self._lib.Client(self._servers)
+ if getattr(self, '_client', None) is None:
+ self._client = self._lib.Client(self._servers)
+
+ return self._client
def _get_memcache_timeout(self, timeout):
"""