Hi,
i just wanted to say my sorries in advance (sorrie/sorry/sorri)…i have
just started learning about the subject of caching, but unfortunately
haven’t effictively managed to implement what i had learned.
obviously it’s possible to cache a whole page, or action with the
caches_page :x or caches_action :y methods, but for some reason it
hasn’t really worked with what i had been doing. (i was trying to cache
Time.now to no avail)
either way, the issue at hand (not Time.now) is trying to cache an
object that i will usually pull out of the database once per
session…say i have a table database.groups and i want to get all of
the records out of the table, and keep them in my application, without
pulling them out every other action (unless i specify otherwise)…
i was hoping there was something as simple as
MyController
#here
caches_action :get_groups
def index
get_groups
end…
def another_action
get_groups
end
…
…
private
#and here
def get_groups
@groups = Group.find(:all)
end
but i can’t get it to work! …i’m in production mode, with the
ActionController::Base.perform_caching = true
and it still isn’t working! …any ideas to what i am doing wrong? oh,
and also how do i ‘abort’ the caching for ‘get_groups’ and overide that
in order to look for the groups in a new db-query? (something like
expire_get_groups)
much thanks in advance,
s