perf: User cache

This commit is contained in:
fit2cloud-chenyw
2025-07-24 11:03:36 +08:00
parent 42651a944f
commit 81e418f1aa
+2
View File
@@ -124,6 +124,8 @@ def cache(
result = await func(*args, **kwargs)
actual_expire = expire + random.randint(-jitter, jitter)
if await backend.get(cache_key):
await backend.clear(cache_key)
await backend.set(cache_key, result, actual_expire)
SQLBotLogUtil.debug(f"Cache set: {cache_key} (expire: {actual_expire}s)")