Skip to content

Commit

Permalink
'Solution'
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackYOSHl committed Nov 30, 2024
1 parent 5891c38 commit e57c7e0
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
from typing import Callable
from typing import Callable, Dict, Tuple


def cache(func: Callable) -> Callable:
# Write your code here
pass
cache_store: Dict[Tuple, any] = {}


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

0 comments on commit e57c7e0

Please sign in to comment.