Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
mishagitcode committed Sep 29, 2023
1 parent 5891c38 commit 7633dc4
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
cache_storage = {}

def inner(*args) -> Callable:

if args in cache_storage:
print("Getting from cache")
else:
print("Calculating new result")
cache_storage[args] = func(*args)

return cache_storage[args]

return inner

0 comments on commit 7633dc4

Please sign in to comment.