Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
refactor: add simple cache func
NTFSvolume49c9554dea1c
diff --git a/cyberdrop_dl/cache.py b/cyberdrop_dl/cache.pyindex 933261e4b..ba5ea72aa 100644--- a/cyberdrop_dl/cache.py+++ b/cyberdrop_dl/cache.py@@ -9,7 +9,7 @@ import loggingimport timefrom typing import TYPE_CHECKING, Any, Protocol, Self, TypedDict, cast, overload-from cyberdrop_dl import __version__+from cyberdrop_dl import __version__, aiofrom cyberdrop_dl.constants import MISSINGif TYPE_CHECKING:@@ -216,6 +216,13 @@ class _CachedMethod[T, R]:return self._cached_fn+def async_lru_cache[T: Callable[[Any], Awaitable[Any]]](fn: T) -> T:+ """Cache the first result.++ Only works with callables that take 1 single argument"""+ return functools.wraps(fn)(aio.async_defaultdict(fn).get) # pyright: ignore[reportReturnType]++class _InMemoryCachedMethod[R](_CachedMethod[object, R]):def _get_cache(self, inst: object) -> TTLCacheAdapter[R]: # noqa: ARG002return _ttl_from_callable(self.wrapped)