summaryrefslogtreecommitdiff
path: root/django/core/cache/__init__.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-11-11 07:18:45 -0800
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-11-11 07:18:45 -0800
commit4c5cea70734fe8f4082c6a9bd8b26cf0a157ca78 (patch)
treede4a70a9ae157d433d759c51e9e39273658d10b5 /django/core/cache/__init__.py
parentcc0ac26f4a3947be8a3fc55d4784d3474b640c23 (diff)
parenta2e927b7ed25bd319f866c55b18cd214a149d859 (diff)
Merge pull request #218 from mgrouchy/ticket_18582
Fixed #18582 -- Added a no-op close to BaseCache
Diffstat (limited to 'django/core/cache/__init__.py')
-rw-r--r--django/core/cache/__init__.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/django/core/cache/__init__.py b/django/core/cache/__init__.py
index d1a02a9f13..562bcc21bb 100644
--- a/django/core/cache/__init__.py
+++ b/django/core/cache/__init__.py
@@ -134,11 +134,9 @@ def get_cache(backend, **kwargs):
"Could not find backend '%s': %s" % (backend, e))
cache = backend_cls(location, params)
# Some caches -- python-memcached in particular -- need to do a cleanup at the
- # end of a request cycle. If the cache provides a close() method, wire it up
- # here.
- if hasattr(cache, 'close'):
- signals.request_finished.connect(cache.close)
+ # end of a request cycle. If not implemented in a particular backend
+ # cache.close is a no-op
+ signals.request_finished.connect(cache.close)
return cache
cache = get_cache(DEFAULT_CACHE_ALIAS)
-