# App ignores cached pages and re-caches them again and again

**URL:** <https://www.ruby-forum.com/t/app-ignores-cached-pages-and-re-caches-them-again-and-again/91234>\
**Category:** Rails\
**Created:** [April 5, 2007, 8:43pm UTC](https://www.ruby-forum.com/t/app-ignores-cached-pages-and-re-caches-them-again-and-again/91234 "2007-04-05T20:43:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tharealpatton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tharealpatton](https://www.ruby-forum.com/u/tharealpatton)\
**Post date:** [April 5, 2007, 8:43pm UTC](https://www.ruby-forum.com/t/app-ignores-cached-pages-and-re-caches-them-again-and-again/91234/1 "2007-04-05T20:43:26Z")

</div>

I’m wondering if anyone has any ideas on what would cause rails to  
write the cached page, but the app ignore the caches pages and instead  
cache it again and again on every request?

I’m setting config.action\_controller.page\_cache\_directory = RAILS\_ROOT  
+"/public/cache/", but it happens when I don’t do that as well.

Any ideas would be greatly appreciated.

Thanks.

PJ

---

<div class="post-metadata">

**Author:** ![tharealpatton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tharealpatton](https://www.ruby-forum.com/u/tharealpatton)\
**Post date:** [April 6, 2007, 6:06pm UTC](https://www.ruby-forum.com/t/app-ignores-cached-pages-and-re-caches-them-again-and-again/91234/2 "2007-04-06T18:06:00Z")

</div>

tharealpatton wrote:

> Actually, correction, caching is fine when I don’t try to set  
> config.action\_controller.page\_cache\_directory. I’ve read a couple  
> places now that this causes the issue. Has anyone found a solution to  
> this?
> 
> PJ

As a work around, symlink your cache dir to the dir where you want it

rm -rf /home/app/tmp/cache  
ln -s /real/cache/dir /home/app/tmp/cache

---

<div class="post-metadata">

**Author:** ![tharealpatton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tharealpatton](https://www.ruby-forum.com/u/tharealpatton)\
**Post date:** [April 6, 2007, 1:45am UTC](https://www.ruby-forum.com/t/app-ignores-cached-pages-and-re-caches-them-again-and-again/91234/3 "2007-04-06T01:45:57Z")

</div>

Actually, correction, caching is fine when I don’t try to set  
config.action\_controller.page\_cache\_directory. I’ve read a couple  
places now that this causes the issue. Has anyone found a solution to  
this?

PJ

---

<div class="post-metadata">

**Author:** ![tharealpatton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tharealpatton](https://www.ruby-forum.com/u/tharealpatton)\
**Post date:** [April 6, 2007, 6:42pm UTC](https://www.ruby-forum.com/t/app-ignores-cached-pages-and-re-caches-them-again-and-again/91234/4 "2007-04-06T18:42:39Z")

</div>

You need to get the server to actually serve the pages from the  
relocated  
cache. This will depend on what server you’re running on. The only  
configuration I’m familiar enough with is Apache. Editing the rewrite  
conditions in public/.htaccess will get you want you want with it. You  
might  
try Googling for solutions on the other server platforms.

RSL
