lulalala
lulalala

Reputation: 17991

Do Rails sql query cache hit database?

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?

Upvotes: 6

Views: 1640

Answers (2)

Tom Harrison
Tom Harrison

Reputation: 14068

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

Upvotes: 5

rovermicrover
rovermicrover

Reputation: 1453

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

Upvotes: -1

Related Questions