diff --git a/django/core/cache/backends/memcached.py b/django/core/cache/backends/memcached.py
a
|
b
|
class CacheClass(BaseCache):
|
16 | 16 | BaseCache.__init__(self, params) |
17 | 17 | self._cache = memcache.Client(server.split(';')) |
18 | 18 | |
19 | | def add(self, key, value, timeout=0): |
20 | | self._cache.add(key.encode('ascii', 'ignore'), value, timeout or self.default_timeout) |
| 19 | def add(self, key, value, timeout=None): |
| 20 | if timeout is None: |
| 21 | timeout = self.default_timeout |
| 22 | if timeout: |
| 23 | self._cache.add(key.encode('ascii', 'ignore'), value, timeout) |
21 | 24 | |
22 | 25 | def get(self, key, default=None): |
23 | 26 | val = self._cache.get(smart_str(key)) |
… |
… |
class CacheClass(BaseCache):
|
29 | 32 | else: |
30 | 33 | return val |
31 | 34 | |
32 | | def set(self, key, value, timeout=0): |
| 35 | def set(self, key, value, timeout=None): |
33 | 36 | if isinstance(value, unicode): |
34 | 37 | value = value.encode('utf-8') |
35 | | self._cache.set(smart_str(key), value, timeout or self.default_timeout) |
| 38 | if timeout is None: |
| 39 | timeout = self.default_timeout |
| 40 | if timeout: |
| 41 | self._cache.set(smart_str(key), value, timeout) |
36 | 42 | |
37 | 43 | def delete(self, key): |
38 | 44 | self._cache.delete(smart_str(key)) |