FEATURE: add immutable caching to rails site of things

This commit is contained in:
Sam
2017-02-23 13:05:00 -05:00
parent eee22bf037
commit f15f61da0a
6 changed files with 16 additions and 10 deletions

View File

@ -66,6 +66,12 @@ class ApplicationController < ActionController::Base
refresh_session(current_user)
end
def immutable_for(duration)
response.cache_control[:max_age] = duration.to_i
response.cache_control[:public] = true
response.cache_control[:extras] = ["immutable"]
end
def dont_cache_page
if !response.headers["Cache-Control"] && response.cache_control.blank?
response.headers["Cache-Control"] = "no-store, must-revalidate, no-cache, private"