rails/rails — pull request #12365 by jbaudanza (2013-09-26 00:42:18+00:00)
Title: Move Rack::Cache after ActionDispatch::Static in the middleware stack

I'd like to propose that Rack::Cache should come later in the middleware stack, after the Static requests are handled. Currently, is it at the beginning.

My reasoning is that Rack::Cache often requires a roundtrip to memcache, which will generally be slower than a trip to disk performed by ActionDispatch::Static.

Also, If Rack::Cache is configured to use the local disk instead of memcache, we ideally want it downstream of Rack::Sendfile.

This change will put Rack::Cache after the following middleware components:

ActionDispatch::SSL
Rack::Sendfile
ActionDispatch::Static

I can't think of any reason why the output of these middleware components should be cached. LMK if I missed something. Thanks!