From 5c583bd478f4e9ed07193aaccd9506967903dc3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Mon, 11 Sep 2023 02:37:08 +0000 Subject: [PATCH] TTL caching improvement --- api/advent22_api/core/webdav.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/api/advent22_api/core/webdav.py b/api/advent22_api/core/webdav.py index 78daf60..117b7b4 100644 --- a/api/advent22_api/core/webdav.py +++ b/api/advent22_api/core/webdav.py @@ -17,7 +17,7 @@ class WebDAV: ) @classmethod - @AsyncTTL(time_to_live=SETTINGS.webdav.cache_ttl) + @AsyncTTL(time_to_live=SETTINGS.webdav.cache_ttl, skip_args=1) async def list_files( cls, directory: str = "", @@ -33,7 +33,7 @@ class WebDAV: return [f"{directory}/{path}" for path in ls if regex.search(path)] @classmethod - @AsyncTTL(time_to_live=SETTINGS.webdav.cache_ttl) + @AsyncTTL(time_to_live=SETTINGS.webdav.cache_ttl, skip_args=1) async def file_exists(cls, path: str) -> bool: """ `True`, wenn an Pfad `path` eine Datei existiert @@ -42,7 +42,7 @@ class WebDAV: return cls._webdav_client.check(path) @classmethod - @AsyncTTL(time_to_live=SETTINGS.webdav.cache_ttl) + @AsyncTTL(time_to_live=SETTINGS.webdav.cache_ttl, skip_args=1) async def read_bytes(cls, path: str) -> bytes: """ Datei aus Pfad `path` als bytes laden @@ -55,7 +55,6 @@ class WebDAV: return buffer.read() @classmethod - @AsyncTTL(time_to_live=SETTINGS.webdav.cache_ttl) async def read_str(cls, path: str, encoding="utf-8") -> str: """ Datei aus Pfad `path` als string laden