Re-add section in SQL Caching

This section was accidentally removed in 4b5e424441, and partially re-added in dc14b893e5.

[ci skip]
This commit is contained in:
Jose Luis Duran 2015-01-11 17:17:21 -02:00
parent 7b47f422cf
commit 4d4f2df36e
1 changed files with 4 additions and 0 deletions

View File

@ -184,6 +184,10 @@ class ProductsController < ApplicationController
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
------------