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
> developing.
> 
> 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
> environment?
> 
> Many thanks,
> Wes

Heroku is different.

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

Additionally, Heroku has a default RACK_ENV of 'production' but you could set 
that to development (or staging) if you like and adjust the behavior in that 
environment. From your app, just type "heroku config" to see what the settings 
are.

Reply via email to