rtomayko/rack-cache

Rails 3.0.14 and Rack Cache Issue

ianlogan opened this issue · 1 comments

I am currently on Rails 3.0.14 and trying to use rack cache 1.2

I have the following in my application.rb:

config.middleware.insert_before ActionDispatch::Static, Rack::Cache,
  :metastore   => 'file:/var/cache/rack/meta',
  :entitystore => 'file:/var/cache/rack/body'
  :verbose => true

When I start the app locally, rack cache does not appear to be doing anything for pages with:

expires_in 3.minutes, :public => true

Is there anything else required to get rack cache working with Rails 3.0.14? (at the moment upgrading to Rails 3.1+ is not an option) Should I be using an older version of rack cache?

I was able to confirm the appropriate headers are being returned

X-Rack-Cache:fresh

It was related to config.action_controller.perform_caching being set to false (in dev).

For others also using Rails 3.0, note that the Rack::Etag middleware also should be used otherwise Etags will be missing if expires_in is used.