Skip to content

Commit 2b8aee8

Browse files
authored
Merge pull request rails#35833 from soartec-lab/update_guide_caching
Fixed description of the `cache_key_with_version` method [skip ci]
2 parents b2209ca + e27a511 commit 2b8aee8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

guides/source/caching_with_rails.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ class Product < ApplicationRecord
302302
end
303303
```
304304

305-
NOTE: Notice that in this example we used the `cache_key_with_version` method, so the resulting cache key will be something like `products/233-20140225082222765838000/competing_price`. `cache_key_with_version` 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.
305+
NOTE: Notice that in this example we used the `cache_key_with_version` method, so the resulting cache key will be something like `products/233-20140225082222765838000/competing_price`. `cache_key_with_version` generates a string based on the model's class name, `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.
306306

307307
### SQL Caching
308308

0 commit comments

Comments
 (0)