mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
perf: User cache
This commit is contained in:
@@ -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)")
|
||||
|
||||
Reference in New Issue
Block a user