Code

Ticket #17943: memcached-close-sockets-patch.diff

File memcached-close-sockets-patch.diff, 475 bytes (added by m.gajda@…, 2 years ago)
Line 
1--- Django-1.3.1-orig/django/core/cache/backends/memcached.py   2012-03-20 22:16:58.502190579 +0100
2+++ Django-1.3.1/django/core/cache/backends/memcached.py    2012-03-20 22:14:24.534717635 +0100
3@@ -23,6 +23,10 @@
4         self._lib = library
5         self._options = params.get('OPTIONS', None)
6 
7+    def __del__(self):
8+        if getattr(self, '_client', None) is not None:
9+            self._client.disconnect_all()
10+
11     @property
12     def _cache(self):
13         """