mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-12-24 05:23:04 +00:00
TTL caching improvement
This commit is contained in:
parent
b00fdee126
commit
5c583bd478
1 changed files with 3 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue