summaryrefslogtreecommitdiff
path: root/django/core/cache/backends/base.py
diff options
context:
space:
mode:
authorEmre Yilmaz <emre.yilmaz@markafoni.com>2015-12-02 12:34:31 +0200
committerTim Graham <timograham@gmail.com>2015-12-04 12:22:17 -0500
commit8e838d9c869083597dc9e161ae2fe37acaa90de9 (patch)
tree51143d2305901aa59d5b957655665dffdef9ef50 /django/core/cache/backends/base.py
parent25f5b5c19dc23c6c09877c9c652a934e9669573d (diff)
Fixed #25840 -- Fixed BaseCache.get_or_set() on the DummyCache backend.
This also fixes a possible data eviction race condition between setting and getting a key. Another thread could remove the key before get_and_set() accesses it again. In this case, now the default value will be returned instead of None.
Diffstat (limited to 'django/core/cache/backends/base.py')
-rw-r--r--django/core/cache/backends/base.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/core/cache/backends/base.py b/django/core/cache/backends/base.py
index 186a45ddd6..af262fecdd 100644
--- a/django/core/cache/backends/base.py
+++ b/django/core/cache/backends/base.py
@@ -165,7 +165,7 @@ class BaseCache(object):
default = default()
val = self.add(key, default, timeout=timeout, version=version)
if val:
- return self.get(key, version=version)
+ return self.get(key, default, version)
return val
def has_key(self, key, version=None):