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