allow decorator_args for timed_alru_cache
This commit is contained in:
parent
f99e45c7bb
commit
a73dc51e25
1 changed files with 3 additions and 3 deletions
|
@ -36,14 +36,14 @@ def get_ttl_hash(seconds: int = 20) -> int:
|
||||||
return round(time() / seconds)
|
return round(time() / seconds)
|
||||||
|
|
||||||
|
|
||||||
def timed_alru_cache(**decorator_kwargs):
|
def timed_alru_cache(*decorator_args, **decorator_kwargs):
|
||||||
"""
|
"""
|
||||||
Decorator which adds an (unused) param `ttl_hash`
|
Decorator which adds an (unused) param `ttl_hash`
|
||||||
and the `@alru_cache` annotation to a function.
|
and the `alru_cache` annotation to a function.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def decorate(f):
|
def decorate(f):
|
||||||
@alru_cache(**decorator_kwargs)
|
@alru_cache(*decorator_args, **decorator_kwargs)
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
async def wrapper(ttl_hash: int, *args, **kwargs):
|
async def wrapper(ttl_hash: int, *args, **kwargs):
|
||||||
del ttl_hash
|
del ttl_hash
|
||||||
|
|
Loading…
Reference in a new issue