This commit is contained in:
retoor 2025-01-24 16:09:10 +01:00
parent c1eeacc0b4
commit 21ab5628b0

17
src/snek/system/cache.py Normal file
View File

@ -0,0 +1,17 @@
import functools
cache = functools.cache
def async_cache(func):
cache = {}
@functools.wraps(func)
async def wrapper(*args):
if args in cache:
return cache[args]
result = await func(*args)
cache[args] = result
return result
return wrapper