mirror of
https://github.com/django/django.git
synced 2025-10-27 23:56:08 +00:00
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.
This commit is contained in:
2
django/core/cache/backends/base.py
vendored
2
django/core/cache/backends/base.py
vendored
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user