From 21ab5628b072320ae0851819116e57539b2397d9 Mon Sep 17 00:00:00 2001
From: retoor <retoor@molodetz.nl>
Date: Fri, 24 Jan 2025 16:09:10 +0100
Subject: [PATCH] Caching.

---
 src/snek/system/cache.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 src/snek/system/cache.py

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