On 8/4/10 11:48 AM, Jim Gay wrote:
On Aug 4, 2010, at 12:35 PM, Wes Gamble wrote:
(apologies if this is a duplicate - I used the Web forum to post this and it 
doesn't show up in the Google groups list).

Currently developing content in a shared app. on Heroku using Radiant,
so officially we are in "production" mode even though we're obviously

We'd like to be able to see layout/page changes immediately.

I've Googled and seen several approached to turning off page caching in
Radiant - what is the most correct way to do this for a production

Many thanks,

Heroku runs a Varnish cache which sits between the request and the application, 
so even if you clear the cache in Radiant, Varnish is totally unaware of this 
and still serves the cached pages according to the cache control headers 
originally set with it.
This is a great feature because it keeps the load on Radiant low, but it does 
take some understanding to work around it when you need.

I've not tested this on heroku, but Radiant has a "dev" rendering option. By 
default this is dev.mysite.com and it will send back headers that say there is no 
caching. So you could add another domain through the addons and set 
Radiant::Config['dev.host'] = 'preview.some-site.com'

But check your config/environments/production.rb file. It should have a comment 
like this:

# Cache your content for a longer time, the default is 5.minutes
# config.after_initialize do
#   SiteController.cache_timeout = 12.hours
# end
Should the SiteController.cache_timeout setting affect the cache control header values?

I modified my production.rb file to read:

config.after_initialize do
  SiteController.cache_timeout = 1.second

but it appears that this doesn't reduce the cache timeout to 1 second.

To restate:

Does the Varnish caching trump the SiteController.cache_timeout value, which implies that I would have to use the dev.host option?


Reply via email to