Is it possible to disable the cache rack for each request in Rails 3.2?

I am trying to work with threads in Rails 3.2 on Heroku (see my SO post here: Rails 3.2 streaming ).

I conclude that rack cache is causing the problem. Disabling it using config.middleware.delete(Rack::Cache)in production.rb seems to fix it. This obviously disables it for my entire application.

I just want it to be disabled for one request stream (which is on the admin side and will be used infrequently). Is it possible? It would be a big bummer to lose caching for the sake of one small (but required) administrator function.

Thank you so much!

Edit: I tried setting the headers so as not to cache the action in question, but Rack :: Cache still causes thread loss. Completely disabling is the only solution I have found so far.

+5
source share
2 answers

I did not have to disable Rack-cache. I just need to add this self.response.headers['Last-Modified'] = Time.now.ctime.to_s to my answer.

+2
source

As long as you cannot turn it off, you may not need it; you just need to get around the caching mechanism.

, Cache-Control: no-cache Pragma: no-cache , Rack:: Cache . , , , , .

, , Rack:: Cache - :

response.headers['Cache-Control'] = 'private,max-age=0,must-revalidate,no-store'

. , Rack:: Cache ( - ) , .

, , , - forward context.rb. , , , , Rack:: Cache, #call, .

+1

All Articles