Ticket #5133: memcached-cleanup-connections.patch
| File memcached-cleanup-connections.patch, 1.3 kB (added by jacob, 1 year ago) |
|---|
-
a/django/core/cache/__init__.py
old new 17 17 18 18 from cgi import parse_qsl 19 19 from django.conf import settings 20 from django.core import signals 20 21 from django.core.cache.backends.base import InvalidCacheBackendError 22 from django.dispatch import dispatcher 21 23 22 24 BACKENDS = { 23 25 # name for use in settings file --> name of module in "backends" directory … … 52 54 return cache_class(host, params) 53 55 54 56 cache = get_cache(settings.CACHE_BACKEND) 57 58 # Some caches -- memcached in particular -- need to do cleanup at the end of a 59 # request cycle. If the cache provides a close() method, wire it up here. 60 if hasattr(cache, "close"): 61 dispatcher.connect(cache.close, signal=signals.request_finished) -
a/django/core/cache/backends/memcached.py
old new 36 36 37 37 def get_many(self, keys): 38 38 return self._cache.get_multi(map(smart_str,keys)) 39 40 def close(self): 41 self._cache.disconnect_all()
