aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2017-08-29 07:23:50 -0400
committerGitHub <noreply@github.com>2017-08-29 07:23:50 -0400
commit07402aa1307a4ff71b4ef6581f95b8612238a6af (patch)
tree111e1c4a8abdda1618a4e4ce9342d945b553a516 /guides
parentca5621d4f25b71f3b59bc8354d4bc1526b14cfcd (diff)
parentddc8f433a9f8878d962992543cf4808770766961 (diff)
downloadrails-07402aa1307a4ff71b4ef6581f95b8612238a6af.tar.gz
rails-07402aa1307a4ff71b4ef6581f95b8612238a6af.tar.bz2
rails-07402aa1307a4ff71b4ef6581f95b8612238a6af.zip
Merge pull request #30447 from yhirano55/update_caching_with_rails
Update Caching with Rails guide [ci skip]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/caching_with_rails.md6
1 files changed, 3 insertions, 3 deletions
diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md
index 2e5f4e3878..cc1e6d92c3 100644
--- a/guides/source/caching_with_rails.md
+++ b/guides/source/caching_with_rails.md
@@ -175,7 +175,7 @@ class Game < ApplicationRecord
end
```
-With `touch` set to true, any action which changes `updated_at` for a game
+With `touch` set to `true`, any action which changes `updated_at` for a game
record will also change it for the associated product, thereby expiring the
cache.
@@ -272,7 +272,7 @@ Sometimes you need to cache a particular value or query result instead of cachin
The most efficient way to implement low-level caching is using the `Rails.cache.fetch` method. This method does both reading and writing to the cache. When passed only a single argument, the key is fetched and value from the cache is returned. If a block is passed, that block will be executed in the event of a cache miss. The return value of the block will be written to the cache under the given cache key, and that return value will be returned. In case of cache hit, the cached value will be returned without executing the block.
-Consider the following example. An application has a `Product` model with an instance method that looks up the product’s price on a competing website. The data returned by this method would be perfect for low-level caching:
+Consider the following example. An application has a `Product` model with an instance method that looks up the product's price on a competing website. The data returned by this method would be perfect for low-level caching:
```ruby
class Product < ApplicationRecord
@@ -284,7 +284,7 @@ class Product < ApplicationRecord
end
```
-NOTE: Notice that in this example we used the `cache_key` method, so the resulting cache-key will be something like `products/233-20140225082222765838000/competing_price`. `cache_key` generates a string based on the model’s `id` and `updated_at` attributes. This is a common convention and has the benefit of invalidating the cache whenever the product is updated. In general, when you use low-level caching for instance level information, you need to generate a cache key.
+NOTE: Notice that in this example we used the `cache_key` method, so the resulting `cache-key` will be something like `products/233-20140225082222765838000/competing_price`. `cache_key` generates a string based on the model's `id` and `updated_at` attributes. This is a common convention and has the benefit of invalidating the cache whenever the product is updated. In general, when you use low-level caching for instance level information, you need to generate a cache key.
### SQL Caching