Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
neeeksa committed Nov 16, 2024
1 parent 5891c38 commit fc235d1
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,16 @@


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

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

return wrapper

0 comments on commit fc235d1

Please sign in to comment.