[Radiant] Really disabling caching

Casper Fabricius me at casperfabricius.com
Tue Feb 12 05:36:15 CST 2008


I have a Radiant-based site that I need to run without any caching,  
because information about the currently logged in user (or a login  
box) is part of the site design.

I thought disabling caching was just a matter of setting:
ResponseCache.defaults[:perform_caching]             = false
- in environment.rb or production.rb, but this doesn't seem to have  
any effect - this setting seems to be completely ignored by  
ResponseCache?

It is in fact this code in SiteController that determines if a page is  
cached:
def show_uncached_page(url)
	...
     @cache.cache_response(url, response) if request.get? and live?  
and @page.cache?
	...
end

- which means that the page will have to return false to avoid  
caching. Since the default Page class is hardcoded to return true, I  
either have to override this setting, or create a new UncachedPage  
type which I use for all pages. The first solution is ugly, but  
nevertheless the way I ended up doing it, since the second solution is  
unfeasible when admins start creating their own pages and so on.

Is there a way to disable caching site-wide I have overlooked, or is  
Radiant simply designed this way?

Cheers,
Casper Fabricius



More information about the Radiant mailing list