diff --git a/django/core/cache/backends/locmem.py b/django/core/cache/backends/locmem.py index b34ce0595c..91e2f2f8da 100644 --- a/django/core/cache/backends/locmem.py +++ b/django/core/cache/backends/locmem.py @@ -58,8 +58,11 @@ class CacheClass(BaseCache): self._lock.reader_leaves() self._lock.writer_enters() try: - del self._cache[key] - del self._expire_info[key] + try: + del self._cache[key] + del self._expire_info[key] + except KeyError: + pass return default finally: self._lock.writer_leaves()