mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 08:13:01 +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
|
@classmethod
|
||||||
@AsyncTTL(time_to_live=SETTINGS.webdav.cache_ttl)
|
@AsyncTTL(time_to_live=SETTINGS.webdav.cache_ttl, skip_args=1)
|
||||||
async def list_files(
|
async def list_files(
|
||||||
cls,
|
cls,
|
||||||
directory: str = "",
|
directory: str = "",
|
||||||
|
@ -33,7 +33,7 @@ class WebDAV:
|
||||||
return [f"{directory}/{path}" for path in ls if regex.search(path)]
|
return [f"{directory}/{path}" for path in ls if regex.search(path)]
|
||||||
|
|
||||||
@classmethod
|
@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:
|
async def file_exists(cls, path: str) -> bool:
|
||||||
"""
|
"""
|
||||||
`True`, wenn an Pfad `path` eine Datei existiert
|
`True`, wenn an Pfad `path` eine Datei existiert
|
||||||
|
@ -42,7 +42,7 @@ class WebDAV:
|
||||||
return cls._webdav_client.check(path)
|
return cls._webdav_client.check(path)
|
||||||
|
|
||||||
@classmethod
|
@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:
|
async def read_bytes(cls, path: str) -> bytes:
|
||||||
"""
|
"""
|
||||||
Datei aus Pfad `path` als bytes laden
|
Datei aus Pfad `path` als bytes laden
|
||||||
|
@ -55,7 +55,6 @@ class WebDAV:
|
||||||
return buffer.read()
|
return buffer.read()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@AsyncTTL(time_to_live=SETTINGS.webdav.cache_ttl)
|
|
||||||
async def read_str(cls, path: str, encoding="utf-8") -> str:
|
async def read_str(cls, path: str, encoding="utf-8") -> str:
|
||||||
"""
|
"""
|
||||||
Datei aus Pfad `path` als string laden
|
Datei aus Pfad `path` als string laden
|
||||||
|
|
Loading…
Reference in a new issue