首页 > 系统服务 > 详细

flask cache

时间:2020-05-19 21:00:15      阅读:52      评论:0      收藏:0      [点我收藏+]

http://brunorocha.org/python/flask/using-flask-cache.html

如何在大项目中使用cache

新建全局cache.py

cache = Cache(config={"CACHE_TYPE": "filesystem", "CACHE_DIR": "/tmp", "CACHE_THRESHOLD": "3000"})

 

在views.py 中导入

from airflow.cache import cache

@cache.cached(timeout=2, key_prefix=make_cache_key)

@expose("/test")

def test():

    return 1

 

在app中导入

from airflow.cache import cache

cache.init_app(app)

 

https://stackoverflow.com/questions/9413566/flask-cache-memoize-url-query-string-parameters-as-well  # more important

https://stackoverflow.com/questions/42721927/flask-cache-memoize-not-working-with-flask-restful-resources

flask cache

原文:https://www.cnblogs.com/buxizhizhoum/p/12919119.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!