diff --git a/app/main.py b/app/main.py index 68287892..91ecfc83 100644 --- a/app/main.py +++ b/app/main.py @@ -1,6 +1,15 @@ from typing import Callable +from typing import Any def cache(func: Callable) -> Callable: - # Write your code here - pass + cache_dict = {} + + def inner(*args: int) -> Any: + if args not in cache_dict: + cache_dict[args] = func(*args) + print("Calculating new result") + else: + print("Getting from cache") + return cache_dict[args] + return inner