客户端缓存
def cache_response(response,max_age=3600,s_maxage=3600):
response.cache_control.public = True
response.cache_control.max_age = max_age
response.cache_control.s_maxage = s_maxage
return response
@alipay_b_api.route('/aaaaaaaaa')
def alipay_applet_hot():
hot = search_message("union_applet_hot")
hot_keyword = hot.message_data if hot else ""
data = {
'code': 200,
'is_show': 1 if hot else 0,
'result': hot_keyword
}
response = jsonify(data)
return cache_response(response)
Nginx缓存
image.pngNGINX内容缓存
Cache-Control
网友评论