diff --git a/CHANGELOG.md b/CHANGELOG.md index 9263f50d..8d8f465d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * Add: option [storage] use_cache_subfolder_for_synctoken for storing 'sync-token' cache outside collection-root * Add: option [storage] folder_umask for configuration of umask (overwrite system-default) * Fix: also remove 'item' from cache on delete +* Improve: avoid automatically invalid cache on upgrade in case no change on cache structure ## 3.3.1 diff --git a/radicale/storage/__init__.py b/radicale/storage/__init__.py index 58f2a499..44f2e758 100644 --- a/radicale/storage/__init__.py +++ b/radicale/storage/__init__.py @@ -32,20 +32,22 @@ from typing import (Callable, ContextManager, Iterable, Iterator, Mapping, import vobject from radicale import config +from radicale.log import logger from radicale import item as radicale_item from radicale import types, utils from radicale.item import filter as radicale_filter INTERNAL_TYPES: Sequence[str] = ("multifilesystem", "multifilesystem_nolock",) -CACHE_DEPS: Sequence[str] = ("radicale", "vobject") -CACHE_VERSION: bytes = "".join( - "%s=%s;" % (pkg, utils.package_version(pkg)) - for pkg in CACHE_DEPS).encode() +# NOTE: change only if cache structure is modified to avoid cache invalidation on update +CACHE_VERSION_RADICALE = "3.3.1" + +CACHE_VERSION: bytes = ("%s=%s;%s=%s;" % ("radicale", CACHE_VERSION_RADICALE, "vobject", utils.package_version("vobject"))).encode() def load(configuration: "config.Configuration") -> "BaseStorage": """Load the storage module chosen in configuration.""" + logger.debug("storage cache version: %r", str(CACHE_VERSION)) return utils.load_plugin(INTERNAL_TYPES, "storage", "Storage", BaseStorage, configuration)