From da7c4126d34c358cd83a0343af800c1c3d4ac5d8 Mon Sep 17 00:00:00 2001 From: James Baer Date: Fri, 17 Mar 2017 16:02:24 -0400 Subject: Improve Caching with Rails Guides [ci skip] Adds the "Caching in Development" section to demonstrate usage of the dev:cache task in development mode. Also, makes a small grammatical correction in section 2.4. --- guides/source/caching_with_rails.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'guides/source/caching_with_rails.md') diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md index fd7626250c..af4ef6a58d 100644 --- a/guides/source/caching_with_rails.md +++ b/guides/source/caching_with_rails.md @@ -396,7 +396,7 @@ config.cache_store = :file_store, "/path/to/cache/directory" ``` With this cache store, multiple server processes on the same host can share a -cache. The cache store is appropriate for low to medium traffic sites that are +cache. This cache store is appropriate for low to medium traffic sites that are served off one or two hosts. Server processes running on different hosts could share a cache by using a shared file system, but that setup is not recommended. @@ -570,6 +570,20 @@ You can also set the strong ETag directly on the response. response.strong_etag = response.body # => "618bbc92e2d35ea1945008b42799b0e7" ``` +Caching in Development +---------------------- + +It's common to want to test the caching strategy of your application +in developement mode. Rails provides the rake task `dev:cache` to +easily toggle caching on/off. + +```bash +$ bin/rails dev:cache +Development mode is now being cached. +$ bin/rails dev:cache +Development mode is no longer being cached. +``` + References ---------- -- cgit v1.2.3 From 17545b4d889149d8185c0a3a78030703d7e70c0e Mon Sep 17 00:00:00 2001 From: Erol Fornoles Date: Tue, 21 Mar 2017 09:21:51 +0800 Subject: Fix typo in Caching with Rails Guide [skip ci] --- guides/source/caching_with_rails.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source/caching_with_rails.md') diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md index af4ef6a58d..aa79f59e4f 100644 --- a/guides/source/caching_with_rails.md +++ b/guides/source/caching_with_rails.md @@ -574,7 +574,7 @@ Caching in Development ---------------------- It's common to want to test the caching strategy of your application -in developement mode. Rails provides the rake task `dev:cache` to +in development mode. Rails provides the rake task `dev:cache` to easily toggle caching on/off. ```bash -- cgit v1.2.3 From 9e14f42a2ece637829eb8db307a105f321a0f77f Mon Sep 17 00:00:00 2001 From: brchristian Date: Thu, 23 Mar 2017 10:00:04 -0700 Subject: Additional explanation about cache implementations --- guides/source/caching_with_rails.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'guides/source/caching_with_rails.md') diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md index aa79f59e4f..798fea9f30 100644 --- a/guides/source/caching_with_rails.md +++ b/guides/source/caching_with_rails.md @@ -387,6 +387,11 @@ store is not appropriate for large application deployments. However, it can work well for small, low traffic sites with only a couple of server processes, as well as development and test environments. +New Rails projects will be configured to use this implementation in the +development environment by default. (Note that, because processes will not share +cache data, if using `:memory_store` it will not be possible to manually read, +write or expire the cache via the Rails console.) + ### ActiveSupport::Cache::FileStore This cache store uses the file system to store entries. The path to the directory where the store files will be stored must be specified when initializing the cache. @@ -403,7 +408,8 @@ share a cache by using a shared file system, but that setup is not recommended. As the cache will grow until the disk is full, it is recommended to periodically clear out old entries. -This is the default cache store implementation. +This is the default cache store implementation (at `"#{root}/tmp/cache/"`) if +no explicit `config.cache_store` is supplied. ### ActiveSupport::Cache::MemCacheStore -- cgit v1.2.3 From 684de497a8c60c9cb367ff2e3657fb785c2a35ea Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Fri, 24 Mar 2017 18:14:01 +0530 Subject: Doc cleanup for caching guide [ci skip] (#28556) --- guides/source/caching_with_rails.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'guides/source/caching_with_rails.md') diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md index 798fea9f30..6cdce5c2f4 100644 --- a/guides/source/caching_with_rails.md +++ b/guides/source/caching_with_rails.md @@ -387,10 +387,10 @@ store is not appropriate for large application deployments. However, it can work well for small, low traffic sites with only a couple of server processes, as well as development and test environments. -New Rails projects will be configured to use this implementation in the -development environment by default. (Note that, because processes will not share -cache data, if using `:memory_store` it will not be possible to manually read, -write or expire the cache via the Rails console.) +New Rails projects are configured to use this implementation in development environment by default. + +NOTE: Since processes will not share cache data when using `:memory_store`, +it will not be possible to manually read, write or expire the cache via the Rails console. ### ActiveSupport::Cache::FileStore -- cgit v1.2.3