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