mmwatch.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:mmwatch 作者: Zverik 项目源码 文件源码
def cached(timeout=1 * 60, key='view'):
    def decorator(f):
        @wraps(f)
        def decorated_function(*args, **kwargs):
            cache_key = '{}/{}'.format(key, request.full_path)
            rv = cache.get(cache_key)
            if rv is not None:
                return rv
            rv = f(*args, **kwargs)
            cache.set(cache_key, rv, timeout=timeout)
            return rv
        return decorated_function
    return decorator
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号