Skip to content

Bulk asynchronous downloader for multiple file hosts

refactor: add get method to cache methods

NTFSvolumedff8c93c475a
diff --git a/cyberdrop_dl/cache.py b/cyberdrop_dl/cache.py
index 7a10e13bd..8e0b5c97f 100644
--- a/cyberdrop_dl/cache.py
+++ b/cyberdrop_dl/cache.py
@@ -26,6 +26,8 @@ class CachedAsyncFunc[T](Protocol):
def clear(self) -> None: ...
+ def get(self) -> T | None: ...
+
class _CachedValue[T](TypedDict):
value: T
@@ -247,6 +249,7 @@ def cached_fn[T](
return value
wrapper.clear = lambda: cache.discard(key) # pyright: ignore[reportAttributeAccessIssue]
+ wrapper.get = lambda: cache.get(key) # pyright: ignore[reportAttributeAccessIssue]
return cast("CachedAsyncFunc[T]", cast("object", wrapper))