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