# Really disabling caching

**URL:** <https://www.ruby-forum.com/t/really-disabling-caching/128884>\
**Category:** Radiant CMS\
**Created:** [February 12, 2008, 12:37pm UTC](https://www.ruby-forum.com/t/really-disabling-caching/128884 "2008-02-12T12:37:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![casperfabricius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4af34b/32.png) [@casperfabricius](https://www.ruby-forum.com/u/casperfabricius)\
**Post date:** [February 12, 2008, 12:37pm UTC](https://www.ruby-forum.com/t/really-disabling-caching/128884/1 "2008-02-12T12:37:23Z")

</div>

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 F.

---

<div class="post-metadata">

**Author:** ![casperfabricius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4af34b/32.png) [@casperfabricius](https://www.ruby-forum.com/u/casperfabricius)\
**Post date:** [February 12, 2008, 3:32pm UTC](https://www.ruby-forum.com/t/really-disabling-caching/128884/2 "2008-02-12T15:32:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![casperfabricius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4af34b/32.png) [@casperfabricius](https://www.ruby-forum.com/u/casperfabricius)\
**Post date:** [February 12, 2008, 6:40pm UTC](https://www.ruby-forum.com/t/really-disabling-caching/128884/3 "2008-02-12T18:40:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![casperfabricius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4af34b/32.png) [@casperfabricius](https://www.ruby-forum.com/u/casperfabricius)\
**Post date:** [February 13, 2008, 5:56am UTC](https://www.ruby-forum.com/t/really-disabling-caching/128884/4 "2008-02-13T05:56:15Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![casperfabricius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4af34b/32.png) [@casperfabricius](https://www.ruby-forum.com/u/casperfabricius)\
**Post date:** [February 13, 2008, 9:03am UTC](https://www.ruby-forum.com/t/really-disabling-caching/128884/5 "2008-02-13T09:03:32Z")

</div>

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
