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