diff --git a/app/main.py b/app/main.py index 68287892f..04795fa79 100644 --- a/app/main.py +++ b/app/main.py @@ -2,5 +2,15 @@ def cache(func: Callable) -> Callable: - # Write your code here - pass + from_cache = {} + + def wrapper(*args, **kwargs) -> Callable: + if args not in from_cache: + func_result = func(*args) + print("Calculating new result") + from_cache[args] = func_result + return func_result + else: + print("Getting from cache") + return from_cache[args] + return wrapper