Skip to content

Commit

Permalink
Complite
Browse files Browse the repository at this point in the history
  • Loading branch information
meff-p committed Dec 20, 2024
1 parent 5891c38 commit 251d696
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,15 @@


def cache(func: Callable) -> Callable:
# Write your code here
pass
storage_cache = {}

def wrapper(*args: int) -> int:
if args in storage_cache:
print("Getting from cache")
return storage_cache[args]
else:
print("Calculating new result")
result = func(*args)
storage_cache[args] = result
return result
return wrapper

0 comments on commit 251d696

Please sign in to comment.