Forum: Ruby on Rails Why does Rails 3.1 store static assets in Rails.cache?

F9d1a09df9178ff326f16913b7e90ad8?d=identicon&s=25 Jack Chu (Guest)
on 2011-08-06 00:22
(Received via mailing list)
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.
F9d1a09df9178ff326f16913b7e90ad8?d=identicon&s=25 Jack Chu (Guest)
on 2011-08-08 19:17
(Received via mailing list)
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?
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.