Why does Rails 3.1 store static assets in Rails.cache?

If you turn on controller caching like this:

config.action_controller.perform_caching = true

it looks like static assets will be written in the Rails.cache with the url as the key. If you precompile your assets in production, why is there a need to put these assets in Rails.cache too? I could see it being useful if you don’t use the asset pipeline I suppose. Is there a way to turn this behavior off without turning off all controller caching?

I’m using redis for my cache_store and static assets are actually eating up a lot of memory. I’ve also tried this with a file_store and the same thing happens, but with disk space instead. It seems a bit redundant though. I’m using Cloudflare as my CDN, so Cloudflare will just hit the static asset once to cache it and never load it up again, so storing assets in Rails.cache is just eating up ram.

I did some digging and tracked it down to Rack::Cache. Rack::Cache is picking up on the default cache-control settings on static assets and storing these requests in the Rails.cache. I can’t think of a way to disable this functionality without affecting how Rails::Cache stores page/action/fragment caching. I can’t change the cache-control because then when the asset if requested from Cloudflare or your browser it wont be cached. Anyone have any ideas?