diff --git a/app/main.py b/app/main.py index b5588bf6..3f929728 100644 --- a/app/main.py +++ b/app/main.py @@ -4,17 +4,15 @@ def cache(func: Callable) -> Callable: cache_dict = {} - def inner(*args, **kwargs) -> None: - key = args + def inner(*args, **kwargs) -> [list, int]: - if key in cache_dict: + if args in cache_dict: print("Getting from cache") - return cache_dict[key] - else: - print("Calculating new result") - result = func(*args, **kwargs) - cache_dict[key] = result + return cache_dict[args] - return result + print("Calculating new result") + cache_dict[args] = func(*args, **kwargs) + + return cache_dict[args] return inner