From 4bb00e607021be606cf450e9fee72cbec8fa54ce Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Sun, 15 Dec 2024 11:40:02 +0100 Subject: [PATCH] item-cache-mtime-size: add new option --- config | 4 ++++ radicale/config.py | 4 ++++ radicale/storage/multifilesystem/__init__.py | 1 + radicale/storage/multifilesystem/base.py | 3 +++ 4 files changed, 12 insertions(+) diff --git a/config b/config index 11c6bc91..731c60f6 100644 --- a/config +++ b/config @@ -155,6 +155,10 @@ # Note: use only on single-instance setup, will break consistency with client in multi-instance setup #use_cache_subfolder_for_synctoken = False +# Use last modifiction time (nanoseconds) and size (bytes) for 'item' cache instead of SHA256 (improves speed) +# Note: check used filesystem mtime precision before enabling +#use_mtime_and_size_for_item_cache=False + # Use configured umask for folder creation (not applicable for OS Windows) # Useful value: 0077 | 0027 | 0007 | 0022 #folder_umask = (system default, usual 0022) diff --git a/radicale/config.py b/radicale/config.py index e824009b..73b04dc4 100644 --- a/radicale/config.py +++ b/radicale/config.py @@ -299,6 +299,10 @@ DEFAULT_CONFIG_SCHEMA: types.CONFIG_SCHEMA = OrderedDict([ "value": "False", "help": "use subfolder 'collection-cache' for 'sync-token' cache file structure instead of inside collection folder", "type": bool}), + ("use_mtime_and_size_for_item_cache", { + "value": "False", + "help": "use mtime and file size instead of SHA256 for 'item' cache (improves speed)", + "type": bool}), ("folder_umask", { "value": "", "help": "umask for folder creation (empty: system default)", diff --git a/radicale/storage/multifilesystem/__init__.py b/radicale/storage/multifilesystem/__init__.py index 6592b515..4e5271f5 100644 --- a/radicale/storage/multifilesystem/__init__.py +++ b/radicale/storage/multifilesystem/__init__.py @@ -97,6 +97,7 @@ class Storage( logger.info("storage cache subfolder usage for 'item': %s", self._use_cache_subfolder_for_item) logger.info("storage cache subfolder usage for 'history': %s", self._use_cache_subfolder_for_history) logger.info("storage cache subfolder usage for 'sync-token': %s", self._use_cache_subfolder_for_synctoken) + logger.info("storage cache use mtime and size for 'item': %s", self._use_mtime_and_size_for_item_cache) logger.debug("storage cache action logging: %s", self._debug_cache_actions) if self._use_cache_subfolder_for_item is True or self._use_cache_subfolder_for_history is True or self._use_cache_subfolder_for_synctoken is True: logger.info("storage cache subfolder: %r", self._get_collection_cache_folder()) diff --git a/radicale/storage/multifilesystem/base.py b/radicale/storage/multifilesystem/base.py index a580cf19..dc013b34 100644 --- a/radicale/storage/multifilesystem/base.py +++ b/radicale/storage/multifilesystem/base.py @@ -74,6 +74,7 @@ class StorageBase(storage.BaseStorage): _use_cache_subfolder_for_item: bool _use_cache_subfolder_for_history: bool _use_cache_subfolder_for_synctoken: bool + _use_mtime_and_size_for_item_cache: bool _debug_cache_actions: bool _folder_umask: str _config_umask: int @@ -92,6 +93,8 @@ class StorageBase(storage.BaseStorage): "storage", "use_cache_subfolder_for_history") self._use_cache_subfolder_for_synctoken = configuration.get( "storage", "use_cache_subfolder_for_synctoken") + self._use_mtime_and_size_for_item_cache = configuration.get( + "storage", "use_mtime_and_size_for_item_cache") self._folder_umask = configuration.get( "storage", "folder_umask") self._debug_cache_actions = configuration.get(