diff --git a/django/core/cache/backends/locmem.py b/django/core/cache/backends/locmem.py
index cab690b..73b02a5 100644
a
|
b
|
class LocMemCache(BaseCache):
|
27 | 27 | def add(self, key, value, timeout=DEFAULT_TIMEOUT, version=None): |
28 | 28 | key = self.make_key(key, version=version) |
29 | 29 | self.validate_key(key) |
30 | | try: |
31 | | pickled = pickle.dumps(value, pickle.HIGHEST_PROTOCOL) |
32 | | except pickle.PickleError: |
33 | | return False |
| 30 | pickled = pickle.dumps(value, pickle.HIGHEST_PROTOCOL) |
34 | 31 | with self._lock.writer(): |
35 | 32 | exp = self._expire_info.get(key) |
36 | 33 | if exp is None or exp <= time.time(): |
… |
… |
class LocMemCache(BaseCache):
|
69 | 66 | def set(self, key, value, timeout=DEFAULT_TIMEOUT, version=None): |
70 | 67 | key = self.make_key(key, version=version) |
71 | 68 | self.validate_key(key) |
72 | | try: |
73 | | pickled = pickle.dumps(value, pickle.HIGHEST_PROTOCOL) |
74 | | except pickle.PickleError: |
75 | | pass |
76 | | else: |
77 | | with self._lock.writer(): |
78 | | self._set(key, pickled, timeout) |
| 69 | pickled = pickle.dumps(value, pickle.HIGHEST_PROTOCOL) |
| 70 | with self._lock.writer(): |
| 71 | self._set(key, pickled, timeout) |
79 | 72 | |
80 | 73 | def incr(self, key, delta=1, version=None): |
81 | 74 | value = self.get(key, version=version) |
… |
… |
class LocMemCache(BaseCache):
|
83 | 76 | raise ValueError("Key '%s' not found" % key) |
84 | 77 | new_value = value + delta |
85 | 78 | key = self.make_key(key, version=version) |
86 | | try: |
87 | | pickled = pickle.dumps(new_value, pickle.HIGHEST_PROTOCOL) |
88 | | except pickle.PickleError: |
89 | | pass |
90 | | else: |
91 | | with self._lock.writer(): |
92 | | self._cache[key] = pickled |
| 79 | pickled = pickle.dumps(new_value, pickle.HIGHEST_PROTOCOL) |
| 80 | with self._lock.writer(): |
| 81 | self._cache[key] = pickled |
93 | 82 | return new_value |
94 | 83 | |
95 | 84 | def has_key(self, key, version=None): |