# Caches\_page issue - seems to be caching but not retrieving!

**URL:** <https://www.ruby-forum.com/t/caches-page-issue-seems-to-be-caching-but-not-retrieving/145692>\
**Category:** Rails\
**Created:** [August 13, 2008, 12:19am UTC](https://www.ruby-forum.com/t/caches-page-issue-seems-to-be-caching-but-not-retrieving/145692 "2008-08-13T00:19:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![terhorst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9e5f3/32.png) [@terhorst](https://www.ruby-forum.com/u/terhorst)\
**Post date:** [August 13, 2008, 12:19am UTC](https://www.ruby-forum.com/t/caches-page-issue-seems-to-be-caching-but-not-retrieving/145692/1 "2008-08-13T00:19:29Z")

</div>

Hi all,  
I’m currently trying to set up caching on my site and am starting by  
trying to cache my homepage but am having a few problems as although it  
seems to be caching (in the log I’ve got 'Cached page: /main.html  
(0.00048)  
'), when I reload, it performs all the queries again and doesn’t appear  
to be retrieving the file from the cache.

Just to give you a bit of background, I have a default route set up  
which states the following:

map.home ‘’, :controller =\> ‘main’, :action =\> “index”

The index action simply queries the database storing the outputs in a  
hash which is used within the view. I have the following queries within  
the controller:

def index  
@hostels=Hostel.count  
@cities=City.find(:all, :order =\> “number\_of\_hostels DESC”, :limit  
=\> “75”, :include =\> “country”)  
@max\_size=City.maximum(‘number\_of\_hostels’)  
@review=Review.find(:first, :order =\> ‘updated\_at desc’)  
end

In environments/development.rb I have the following line:

config.action\_controller.perform\_caching = true

In my controller I have the following lines:

caches\_page :index

I’ve been tearing my hair out over this as I can’t see why it wouldn’t  
work - would very much appreciate it if someone can point me in the  
right direction!

One other thing is that this appears to work if I change caches\_page to  
caches\_action…  
Thanks a lot,  
Jonathan
