On 8/4/10 4:05 PM, Jim Gay wrote:
On Wed, Aug 4, 2010 at 5:03 PM, Wes Gamble <we...@att.net <mailto:we...@att.net>> wrote:

     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
            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 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
            <http://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 <http://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
    end

    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?

    Thanks,
    Wes


If the SiteController.cache_timeout change isn't working, it's a bug.
Varnish accepts the headers that your app sends to it, so if you say it's 1 second, then Varnish will cache it for 1 second.

I'll look into this too, but reply back if you dig deeper.
Jim,

It works fine. I'm a little embarrassed. My app. is a standard Rails app. with Radiant installed in RAILS_ROOT/vendor/radiant (because I'm using Heroku, apparently I needed to install the Radiant app this way), and I modified the production.rb file under vendor/radiant instead of RAILS_ROOT.

Thanks for the help,
Wes

Wes

Reply via email to