[raleigh.rb] Caching AR queries

Matthew Bass pelargir at gmail.com
Sat Apr 2 16:50:24 EDT 2011


On Apr 2, 2011, at 4:47 PM, Nathaniel Talbott wrote:

> Rails automatically caches queries for the duration of a request, right?
> 
>  http://guides.rubyonrails.org/caching_with_rails.html#sql-caching
> 
> Unless the objects you're wanting to cache take a long time to load
> for some reason, I'd be somewhat surprised if caching them for longer
> than a request cycle bought you much in the way of improved
> performance. Have you been able to do any measurements around the time
> to load these objects?

The quirk in this case is that it's not a flat list of objects... it's a tree structure. Each object has a parent and may have children. The tree can only go 3 levels deep, but it makes it challenging to access it in a way that doesn't trigger cascading queries.

I think I may have found a simple way to achieve what I want with Rails.cache

Matthew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20110402/62e16983/attachment.html>


More information about the raleigh-rb-members mailing list