mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-02-26 13:36:35 +08:00
16 lines
362 B
Python
16 lines
362 B
Python
from .instances import cache
|
|
|
|
|
|
def from_cache(key):
|
|
def decorator(func):
|
|
def wrapper(*args, **kwargs):
|
|
cached = cache.get(key)
|
|
if cached:
|
|
return cached
|
|
else:
|
|
result = func(*args, **kwargs)
|
|
cache.set(key, result)
|
|
return result
|
|
|
|
return wrapper
|