application.py 文件源码

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

项目:sitrep 作者: bittorrent 项目源码 文件源码
def cache(self, seconds=60):
        def inner_decorator(f):
            @wraps(f)
            def wrapper(*args, **kwds):
                resp = f(*args, **kwds)
                if not isinstance(resp, flask.Response):
                    resp = flask.make_response(resp)
                resp.headers['Cache-Control'] = 'public, max-age={}'.format(seconds)
                resp.headers["Expires"] = time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(time.time() + seconds))
                resp.add_etag()
                return resp
            return wrapper
        return inner_decorator
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号