diff --git a/src/snek/system/cache.py b/src/snek/system/cache.py new file mode 100644 index 0000000..2992803 --- /dev/null +++ b/src/snek/system/cache.py @@ -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 \ No newline at end of file