# decos | 小棉智能
可爱，智能且易扩展

Skip to content

# 模块 `nonebot_plugin_marshoai.decos` ​

### func `from_cache(key)` ​

源代码 或 在GitHub上查看
python

    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