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