How to cache queries in Rails across multiple requests
Posted
by m.u.sheikh
on Stack Overflow
See other posts from Stack Overflow
or by m.u.sheikh
Published on 2010-04-12T14:23:41Z
Indexed on
2010/04/12
15:13 UTC
Read the original article
Hit count: 391
I want to cache query results so that the same results are fetched "for more than one request" till i invalidate the cache. For instance, I want to render a sidebar which has all the pages of a book, much like the index of a book. As i want to show it on every page of the book, I have to load it on every request. I can cache the rendered sidebar index using action caching, but i also want to actually cache the the query results which are used to generate the html for the sidebar. Does Rails provide a way to do it? How can i do it?
© Stack Overflow or respective owner