Skip to content

Commit

Permalink
'Solution'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dizatvarska committed Nov 28, 2024
1 parent 769e61c commit bcac201
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from typing import Callable, Any
from functools import wraps


def cache(func: Callable) -> Any:
results = {}
wraps(func)

def wrapper(*args, **kwargs) -> Any:
key = tuple(args)
key += tuple(*kwargs.items())
key = tuple(args) + tuple(*kwargs.items())
if key in results:
print("Getting from cache")
return results[key]
Expand Down

0 comments on commit bcac201

Please sign in to comment.