1

I am looking through some legacy code and I see this:

In the 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

In a controller:

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

and I think the CDN is Akamai. On a high level, what is going on here?

Jwan622
  • 11,015
  • 21
  • 88
  • 181
  • seems to be checking to see whether they need to update cached data. if it's been modified, make an api call and get the new data. if not, use the cache. – toddmetheny Mar 11 '16 at 21:58

0 Answers0