Skip to content

Commit

Permalink
Try to fix Valentine's remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
ihorhalyskiy committed Dec 2, 2024
1 parent 159dcc3 commit 8866462
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
def cache(func: Callable) -> Callable:
cached_data = {}

def wrapper(*args) -> None:
def wrapper(*args) -> Callable:

cache_data_check = args

if cache_data_check in cached_data:
if args in cached_data:
print("Getting from cache")
return cached_data[args]
else:
result = func(*args)
cached_data.update({cache_data_check: result})
print("Calculating new result")
return cached_data[cache_data_check]
cached_data[args] = func(*args)
return cached_data[args]

return wrapper

0 comments on commit 8866462

Please sign in to comment.