mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
If cache load fails because objects are from a different version and throw an exception, clear the cache.
This commit is contained in:
@@ -21,7 +21,13 @@ class SingleObjectDataCache:
|
||||
# This cache stores a single object, doesn't matter what it's called so "object" will do
|
||||
if "object" not in self._cache:
|
||||
self._cache.add("object", object_if_empty)
|
||||
self._obj = self._cache.get("object")
|
||||
try:
|
||||
self._obj = self._cache.get("object")
|
||||
except Exception:
|
||||
logger.warning(f"Failed to load cache from {cache_dir}, clearing it.")
|
||||
self._cache.clear()
|
||||
self._cache.add("object", object_if_empty)
|
||||
self._obj = object_if_empty
|
||||
|
||||
def get(self):
|
||||
"""Get the data object. This can then be manipulated as necessary across multiple threads. Any function
|
||||
|
||||
Reference in New Issue
Block a user