module Rack::Response::Helpers
def cache!(duration = 3600, directive: "public")
(**directive)
-
The
(String
) -- cache control directive, one of "public", "private", "no-cache" or "no-store".
Parameters:
-
duration
(Integer
) -- The number of seconds until the cache expires.
def cache!(duration = 3600, directive: "public") unless headers[CACHE_CONTROL] =~ /no-cache/ set_header CACHE_CONTROL, "#{directive}, max-age=#{duration}" set_header EXPIRES, (Time.now + duration).httpdate end end