Class: AgileProxy::Rack::GetOnlyCache

Inherits:
Object
  • Object
show all
Defined in:
lib/agile_proxy/rack/get_only_cache.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ GetOnlyCache

Returns a new instance of GetOnlyCache.



6
7
8
# File 'lib/agile_proxy/rack/get_only_cache.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/agile_proxy/rack/get_only_cache.rb', line 9

def call(env)
  force_caching(env)
  request = ::ActionDispatch::Request.new(env)
  if request.request_method_symbol == :get
    cache_app.call(env)
  else
    @app.call(env)
  end
end