TTL caching improvement

This commit is contained in:
Jörn-Michael Miehe 2023-09-11 02:37:08 +00:00
parent b00fdee126
commit 5c583bd478

View file

@ -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