From 7f0e230af4a86123e1043d32d706202874216567 Mon Sep 17 00:00:00 2001 From: Goffi Date: Sat, 15 Oct 2022 20:37:00 +0200 Subject: [PATCH] tools (common/async_utils): set default `maxsize` to 50 in `async_lru` --- sat/tools/common/async_utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sat/tools/common/async_utils.py b/sat/tools/common/async_utils.py index e2912ea8..bf14c594 100644 --- a/sat/tools/common/async_utils.py +++ b/sat/tools/common/async_utils.py @@ -27,8 +27,13 @@ from sat.core.log import getLogger log = getLogger(__name__) -def async_lru(maxsize: Optional[int] = None) -> Callable: - """Decorator to cache async function results using LRU algorithm""" +def async_lru(maxsize: Optional[int] = 50) -> Callable: + """Decorator to cache async function results using LRU algorithm + + @param maxsize: maximum number of items to keep in cache. + None to have no limit + + """ def decorator(func: Callable) -> Callable: cache = OrderedDict() async def wrapper(*args) -> Awaitable: