Hi,

I don't think that would work well for the purpose that query caching
serves.

Query caching takes advantage of the fact that Rails is for web apps, which
operate in request-response cycles. Each request starts with a clean cache.
The query cache is there so that within the scope of handling a single
request, if the code makes the same call multiple times (without an
intervening write), it will get the same answer without having to go to the
database again.

If the query cache were to go across handlers, it would be impossible to
know when the cache should be cleared. Clearing it when one handler is done
would cause it to be cleared right in the middle of another handler. Then
it wouldn't serve the purpose for which it was designed.

Brian Morearty



On Wed, Oct 9, 2013 at 9:32 PM, Stewart <[email protected]> wrote:

> Hi,
>
> It seems that Active record query caching is all done in memory. This is
> fine untill you need to run with unicorn that will have multiple workers
> each with their own connection.  It would be nice to be able to configure a
> query caching backend in the same way active support configures caching in
> other parts of rails thus allowing for a shared cache between workers. Is
> this functionally worth investigating? Have I missed something in the
> source code that already does this?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to