0

I've got a rails app hosted on heroku. I'm trying to make some basic http caching, but I can't make it work in development (I've not tried in production yet). I'm not even sure if my controller code is the one I need.

How can I make this work in dev env? Are there any caveats for production?

development.rb

config.action_controller.perform_caching = true

production.rb

config.cache_store = :dalli_store,
                (ENV["MEMCACHIER_SERVERS"] || "").split(","),
                {:username => ENV["MEMCACHIER_USERNAME"],
                 :password => ENV["MEMCACHIER_PASSWORD"],
                 :failover => true,
                 :socket_timeout => 1.5,
                 :socket_failure_delay => 0.2,
                 :pool_size => ENV["MAX_THREADS"]
                }

static page controller

 def about
   expires_in 24.hours, :public => true
 end

response for caching:

Cache-Control: must-revalidate, private, max-age=0
Sean Magyar
  • 2,360
  • 1
  • 25
  • 57

0 Answers0