# decos | Marsho AI
Kawaii, Intelligent and Easy to Extend

Skip to content

# Module `nonebot_plugin_marshoai.decos` ​

### func `from_cache(key)` ​

Source code or View on 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