tools (common/async_utils): set default maxsize to 50 in async_lru
This commit is contained in:
parent
b91bc6fa2d
commit
7f0e230af4
1 changed files with 7 additions and 2 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue