6
votes

In my Rails application I see a few 'cache' during SQL query in the server log:

[DEBUG] CACHE (0.0ms) SELECT regions.* FROM regions WHERE regions.name = 'NY' LIMIT 1

I want to know if these caching are done by Rails, or by the MySQL itself? In another word, do these cached queries touch the database layer at all?

2
can you change accepted answer to other one? - hlcs
@hlcs I don't know why the chosen answer got downvoted? Clearly it says the same thing as the other answer no? - lulalala
@lulalaIa accepted answer says how to bypass chaching. The question is: do these cached queries touch the database. - hlcs
@hlcs I guess chosen answer implies the "no" answer, provided with reference evidence which I felt more trustworthy. - lulalala

2 Answers

5
votes

The correct answer to the question is "the caching is done by Rails; the queries do not ever get to the database".

-1
votes

According to the following blog post on how to disable said feature its on rails cache and no the DB cache.

https://coderwall.com/p/tvybhq