From 4d4f2df36e46558a913efb3a58a6e21fba21f937 Mon Sep 17 00:00:00 2001 From: Jose Luis Duran Date: Sun, 11 Jan 2015 17:17:21 -0200 Subject: Re-add section in SQL Caching This section was accidentally removed in 4b5e424441149cf0f61a8182f4a92999577ce59a, and partially re-added in dc14b893e5904acb37ac327478f3880f33094b7a. [ci skip] --- guides/source/caching_with_rails.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'guides') diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md index 61b991df61..d5477eb72d 100644 --- a/guides/source/caching_with_rails.md +++ b/guides/source/caching_with_rails.md @@ -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 ------------ -- cgit v1.2.3