Skip to content

Commit

Permalink
develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ihorhalyskiy committed Nov 29, 2024
1 parent 44b15fa commit 159dcc3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@


def cache(func: Callable) -> Callable:
cashed_data = {}
cached_data = {}

def wrapper(*args) -> None:

cache_data_check = args

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

0 comments on commit 159dcc3

Please sign in to comment.