Commit Graph

121 Commits

Author SHA1 Message Date
Alex Ghiculescu
51b8ddf49e Docs: advise against caching AR objects
Based on this comment https://github.com/rails/rails/issues/43767#issuecomment-1000988644

Closes https://github.com/rails/rails/issues/43767
2021-12-27 14:11:06 -06:00
Jean Boussier
fbf3bf8cac Document the new Active Support cache format 2021-04-26 11:20:59 +02:00
John Bampton
1825c2b6c5 chore: fix spelling 2021-04-15 15:49:48 +10:00
John Bampton
13b1d9dc35 chore: fix grammar and spelling 2021-04-12 05:30:44 +10:00
Rafael França
ea0cce4929
Merge pull request #40919 from ghiculescu/patch-2
Mention `rails dev:cache` in Caching with Rails guide [ci skip] [docs]
2020-12-29 18:14:20 -05:00
Rafael França
947a9f903a
Merge pull request #39575 from jonathanhefner/clarify-null_store-behavior
Clarify ActiveSupport::Cache::NullStore behavior [ci skip]
2020-12-28 20:47:45 -05:00
Jonathan Hefner
cb0da4f817 Fix typos, grammar, and formatting [ci-skip]
This is a collection of minor superficial improvements.  It does not
include any significant content changes.
2020-12-28 12:05:53 -06:00
Jonathan Hefner
27786c8d1e Normalize code indentation [ci-skip]
This removes unnecessary indentation of several code snippets, and
otherwise normalizes indentation of a handful more.
2020-12-25 21:17:50 -06:00
Alex Ghiculescu
8ade0f9f7b
Mention rails dev:cache in Caching with Rails guide
On a new Rails app, [`config/development.rb`](https://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt#L19) is set up to support [`rails dev:cache`](https://github.com/rails/rails/pull/20961).

This PR explains how to enable caching in development in https://guides.rubyonrails.org/caching_with_rails.html, replacing the old advice that looks like it came before https://github.com/rails/rails/pull/20961.
2020-12-23 13:55:41 -06:00
Sam Bostock
e79364610c
Fallback to $MEMCACHE_SERVERS if no servers given
By default, Dalli has two fallbacks if no server addresses are given:

- $MEMCACHE_SERVERS
- "127.0.0.1:11211"

However, MemCacheStore does its own check for addresses, and falls back
to "localhost:11211" if none are present.

This can lead to bugs in migrations from the deprecated :dalli_store
(provided by the Dalli) to :mem_cache_store:

```diff
-config.cache_store = :dalli_store     # could be implicitly relying on $MEMCACHE_SERVERS
+config.cache_store = :mem_cache_store # ignores $MEMCACHE_SERVERS
```

By removing our own fallback and simply passing `nil` to Dalli::Client,
we get its fallback logic for free. Tests are added so we can detect if
this ever changes.
2020-10-20 23:50:52 -04:00
Jonathan Hefner
e8b5736531 Clarify ActiveSupport::Cache::NullStore behavior [ci skip]
The caching guide currently indicates that values are not cached at all
when using ActiveSupport::Cache::NullStore.  However, values *are*
cached within the scope of a single web request.

This commit changes the guide to reflect that.

Closes #38638.
2020-09-07 11:29:46 -05:00
Ryuta Kamizono
8cdeeb5b26 Fix syntax error [ci skip] 2020-02-05 16:04:59 +09:00
Petrik
ee017047e6 Add CacheStore connection pool docs to guide [ci skip]
When using Puma or another threaded server it is useful to know about
connection pool options for the cache stores. This commit explains how
to configure and enable the connection pool in the guides.
2020-01-26 11:30:42 +01:00
Haroon Ahmed
db1ae8cbb4 remove reference to global rails command and replace with bin/rails 2019-12-27 19:32:37 +00:00
BelenRemedi
4bf9e49ec4 show consitency in cache key and avoid getting into implementation details 2019-11-22 10:12:00 -03:00
BelenRemedi
ada6055e1f Update fragment caching doc [ci skip] 2019-11-09 03:14:24 -03:00
soartec-lab
e27a511b66 Fixed description of the cache_key_with_version method [ci skip] 2019-04-03 09:46:29 +09:00
Abhay Nikam
476abd403b Updated links from http to https in guides, docs, etc 2019-03-09 16:43:47 +05:30
alkesh26
97909ddcf2 Changed webserver to web server. 2019-01-22 21:11:03 +05:30
tnantoka
95f9af8257 Use cache_key_with_version instead of cache_key for the example in Low-Level Caching [ci skip] 2018-11-26 13:21:24 +09:00
tnantoka
96a31c41af Replace cache_key with cache_key_with_version on caching_with_rails guides [ci skip] 2018-11-16 11:24:15 +09:00
Graham Turner
b1059f3cf0 Updates expires_in docs
Previously the documentation for expires_in suggested that the option
was available for all cache stores. This clarifies that the behavior can
be supported, but is not always supported.
2018-09-28 13:29:38 -04:00
Matthew Draper
ec387c6dd9
Merge pull request #33229 from albertoalmagro/albertoalmagro/prefer-rails-command-over-bin-rails
Prefer rails command over bin/rails
2018-07-25 04:10:29 +09:30
Paul McMahon
7b9c19d94b Rails guides are now served over https
http links will be redirected to the https version, but still better to
just directly link to the https version.
2018-07-24 11:29:31 +09:00
Alberto Almagro
2e194d0c9e Substitute references to task for command
This commit substitutes references to rails/rake task for rails command
2018-07-06 22:46:54 +02:00
Alberto Almagro
40b209db53 Recommend use of rails over bin/rails
As discussed in #33203 rails command already looks for, and runs,
bin/rails if it is present.

We were mixing recommendations within guides and USAGE guidelines,
in some files we recommended using rails, in others bin/rails and
in some cases we even had both options mixed together.
2018-07-06 22:46:35 +02:00
Anthony Crumley
258670244d Added a lot of Oxford commas
[ci skip] A regular expression was used to find a lot of missing Oxford
commas and add them.  The regular expression was as follows.

", ([a-zA-Z0-9.\`:'\"]+ ){1,6}(or|and) "
2018-05-10 12:46:06 -05:00
Stefan Wrobel
a6b82a3779 Update Redis cache store docs 2018-03-17 16:09:09 -07:00
Brian Kephart
8f98054ef9 Document :reconnect_attempts option for Redis Cache Store [ci skip] 2018-02-17 22:51:58 -08:00
Eugene Kenny
d034f488f9 Use SHA-1 for non-sensitive digests by default
Instead of providing a configuration option to set the hash function,
switch to SHA-1 for new apps and allow upgrading apps to opt in later
via `new_framework_defaults_5_2.rb`.
2018-01-08 20:45:46 +00:00
Yauheni Dakuka
b6baf0c884 Cosmetic changes [ci skip] 2017-11-30 09:35:26 +03:00
Jeremy Daer
ed10016687 Cache: Enable compression by default for values > 1kB.
Compression has long been available, but opt-in and at a 16kB threshold.
It wasn't enabled by default due to CPU cost. Today it's cheap and
typical cache data is eminently compressible, such as HTML or JSON
fragments.

Compression dramatically reduces Memcached/Redis mem usage, which means
the same cache servers can store more data, which means higher hit
rates.

To disable compression, pass `compress: false` to the initializer.
2017-11-13 22:02:45 -07:00
Jeremy Daer
9f8ec35352 Built-in Redis cache store
* Supports vanilla Redis, hiredis, and Redis::Distributed.
* Supports Memcached-like sharding across Redises with Redis::Distributed.
* Fault tolerant. If the Redis server is unavailable, no exceptions are
  raised. Cache fetches are treated as misses and writes are dropped.
* Local cache. Hot in-memory primary cache within block/middleware scope.
* `read_/write_multi` support for Redis mget/mset. Use Redis::Distributed
  4.0.1+ for distributed mget support.
* `delete_matched` support for Redis KEYS globs.
2017-11-13 19:45:47 -07:00
Yauheni Dakuka
62d547c6a4 Upcase js [ci skip] 2017-09-18 09:15:33 +03:00
Eileen M. Uchitelle
86389b4143 Merge pull request #29964 from gwincr11/cg-partial-caching
Add documentation about template partial caching
2017-08-30 08:38:53 -04:00
Cory Gwin @gwincr11
49f6c47e41 Add documentation about template partial caching
Motivation:
  - #29423 surfaced some confusion about how template caching works when
  using partials across files with different mime types. This doc
  attempts to explain how this can be accomplished.
2017-08-30 08:36:58 -04:00
Ryuta Kamizono
c4e576fc7f It should be "the resulting cache key", not "the resulting cache-key" [ci skip]
This is a partial revert of 07402aa1307a4ff71b4ef6581f95b8612238a6af.

I also changed "cache-key" to "cache key" because "cache-key" appears
only once in the repo.

```
% git grep '\bcache-key\b' | wc -l
1

% git grep '\bcache key\b' | wc -l
28
```
2017-08-29 20:44:04 +09:00
Yoshiyuki Hirano
ddc8f433a9 Update Caching with Rails guide [ci skip] 2017-08-29 06:42:36 +09:00
Ryuta Kamizono
4b3ee155f9 Remove trailing spaces [ci skip] 2017-08-27 22:29:56 +09:00
Vipul A M
684de497a8 Doc cleanup for caching guide [ci skip] (#28556) 2017-03-24 18:14:01 +05:30
brchristian
9e14f42a2e Additional explanation about cache implementations 2017-03-23 10:00:04 -07:00
Erol Fornoles
17545b4d88
Fix typo in Caching with Rails Guide [skip ci] 2017-03-21 09:21:51 +08:00
James Baer
da7c4126d3 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.
2017-03-17 16:02:24 -04:00
Ryunosuke Sato
b9e98d62c2 Remove the word "mongrel" from documents
Currently mongrel is not maintained.
And it couldn't be built with any Ruby versions that
supported by Rails.

It is reasonable to remove the word "mongrel" in order to avoid
confusion from newcomer.
2016-09-07 01:59:37 +09:00
Santosh Wadghule
80f777e1c0 Add documentation for http_cache_forever. [ci skip] 2016-08-10 20:27:29 +05:30
प्रथमेश Sonpatki
56527bb737 Merge pull request #25928 from mechanicles/info-for-cache-fetch-block
Add proper description for `Rails.cache.fetch` [ci skip]
2016-07-24 10:13:41 +05:30
Santosh Wadghule
d4f1b8090a Proper description for Rails.cache.fetch [ci skip] 2016-07-24 09:37:44 +05:30
Santosh Wadghule
8ad6260538 Explain meaning of the code very well and Remove confusion. [ci skip]
Code like `render(topics) => render("topics/topic")` adds confusion
for the readers. On first impression, that code feels like hash kind
of data, but it's not. So make it more clear and meaningful.
2016-07-23 09:56:35 +05:30
Jon Moss
303dac30c2
md5 --> MD5
[ci skip]
2016-05-16 15:51:05 -04:00
Roque Pinel
e08232cda2 Fixes for the strong & weak ETags guide [ci skip] 2016-04-07 23:18:50 -04:00