Skip to content

Commit

Permalink
cache kwargs for function
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyCMWF committed Sep 2, 2024
1 parent 683d4b0 commit b98c1f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cacholote/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def _decode_and_update(
return result


def cacheable(func: F) -> F:
def cacheable(func: F, **cache_kwargs) -> F:
"""Make a function cacheable."""

@functools.wraps(func)
Expand All @@ -56,7 +56,7 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
return func(*args, **kwargs)

try:
hexdigest = encode._hexdigestify_python_call(func, *args, **kwargs)
hexdigest = encode._hexdigestify_python_call(func, *args, **kwargs, **cache_kwargs)
except encode.EncodeError as ex:
if settings.return_cache_entry:
raise ex
Expand Down

0 comments on commit b98c1f2

Please sign in to comment.