class GitHeroes::Cache

Public Instance Methods

call(env, *args) click to toggle source
# File lib/git_heroes/cache.rb, line 5
def call(env, *args)
  # do something with the request
  force_cache = !! env[:request_headers]['X-Force-Cache']

  @app.call(env).on_complete do |response|
    # do something with the response
    if force_cache
      response[:response_headers]['cache-control'] = 'public, max-age=31536000'
    end
  end
end