我正在查看一些遗留代码,我看到了:
在application_controller.rb
中def set_cache_buster
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
end
在控制器中:
respond_to do |format|
format.json_v20150315 do
set_cache_buster
if stale?(last_modified: last_modified_for_models(recipes, current_api_user), etag: etag_for_models(recipes, current_api_user))
render json: recipes, compact: true, each_serializer: Api::V20150315::RecipeSerializer, user: current_api_user
end
end
我认为CDN是Akamai。从高层次来看,这里发生了什么?