mirror of https://github.com/rails/rails
Re-add section in SQL Caching
This section was accidentally removed in4b5e424441
, and partially re-added indc14b893e5
. [ci skip]
This commit is contained in:
parent
7b47f422cf
commit
4d4f2df36e
|
@ -184,6 +184,10 @@ class ProductsController < ApplicationController
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The second time the same query is run against the database, it's not actually going to hit the database. The first time the result is returned from the query it is stored in the query cache (in memory) and the second time it's pulled from memory.
|
||||||
|
|
||||||
|
However, it's important to note that query caches are created at the start of an action and destroyed at the end of that action and thus persist only for the duration of the action. If you'd like to store query results in a more persistent fashion, you can in Rails by using low level caching.
|
||||||
|
|
||||||
Cache Stores
|
Cache Stores
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue