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