From c0767bc4a0545720c59f9a893616ea8dd2d867a8 Mon Sep 17 00:00:00 2001 From: Tomasz Koch Date: Tue, 26 May 2026 13:55:46 +0200 Subject: [PATCH] v1 of my solution --- app/main.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/main.py b/app/main.py index 68287892f..04795fa79 100644 --- a/app/main.py +++ b/app/main.py @@ -2,5 +2,15 @@ def cache(func: Callable) -> Callable: - # Write your code here - pass + from_cache = {} + + def wrapper(*args, **kwargs) -> Callable: + if args not in from_cache: + func_result = func(*args) + print("Calculating new result") + from_cache[args] = func_result + return func_result + else: + print("Getting from cache") + return from_cache[args] + return wrapper