Really disabling caching

View: New views
5 Messages — Rating Filter:   Alert me  

Really disabling caching

by Casper Fabricius :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: Really disabling caching

by Sean Cribbs-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Casper,

Confirm that your individual environment files (config/environment) do
not override the default you have set.  You can do this by putting that
setting outside the initializer block, or by changing the value in the
individual environment files.

Sean

Casper Fabricius wrote:

> 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
> _______________________________________________
> Radiant mailing list
> Post:   Radiant@...
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>
>  

_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: Really disabling caching

by Casper Fabricius :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sean,

Thanks for your answer. I already did that. I also looked through the  
code of ResponseCache. Where does it use the "perform_caching"  
setting, because I for one can't find it? I'm not pointing any fingers  
here, I'm just asking, is anyone actually running Radiant with caching  
completely disabled and can confirm that it can be disabled?

Cheers,
Casper

On 12/02/2008, at 15:32, Sean Cribbs wrote:

> Casper,
>
> Confirm that your individual environment files (config/environment) do
> not override the default you have set.  You can do this by putting  
> that
> setting outside the initializer block, or by changing the value in the
> individual environment files.
>
> Sean
>
> Casper Fabricius wrote:
>> 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
>> _______________________________________________
>> Radiant mailing list
>> Post:   Radiant@...
>> Search: http://radiantcms.org/mailing-list/search/
>> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>>
>>
>
> _______________________________________________
> Radiant mailing list
> Post:   Radiant@...
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: Really disabling caching

by Daniel Sheppard-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Thanks for your answer. I already did that. I also looked
> through the  
> code of ResponseCache. Where does it use the "perform_caching"  
> setting, because I for one can't find it? I'm not pointing
> any fingers  
> here, I'm just asking, is anyone actually running Radiant
> with caching  
> completely disabled and can confirm that it can be disabled?

In ResponseCache, the expire_page, cache_page and update_response methods use 'return unless perform_caching' to no-op if caching is
disabled.

Dan.

_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: Really disabling caching

by Casper Fabricius :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dan, you're right, and I must have been blind when I wrote my previous  
mail. Now that I see that the setting is in fact used by  
ResponseCache, it must obviously be a problem with my config-files.

Thanks,
Casper

On 13/02/2008, at 5:52, Daniel Sheppard wrote:

>> Thanks for your answer. I already did that. I also looked
>> through the
>> code of ResponseCache. Where does it use the "perform_caching"
>> setting, because I for one can't find it? I'm not pointing
>> any fingers
>> here, I'm just asking, is anyone actually running Radiant
>> with caching
>> completely disabled and can confirm that it can be disabled?
>
> In ResponseCache, the expire_page, cache_page and update_response  
> methods use 'return unless perform_caching' to no-op if caching is
> disabled.
>
> Dan.
>
> _______________________________________________
> Radiant mailing list
> Post:   Radiant@...
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

_______________________________________________
Radiant mailing list
Post:   Radiant@...
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant