If cache load fails because objects are from a different version and throw an exception, clear the cache.

This commit is contained in:
Ian Renton
2026-09-19 08:04:50 +01:00
parent 59d5f61d90
commit c9c8ffc1f7
10 changed files with 28 additions and 17 deletions
+7 -1
View File
@@ -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