aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorJeremy Daer <jeremydaer@gmail.com>2017-11-13 19:16:53 -0700
committerJeremy Daer <jeremydaer@gmail.com>2017-11-13 22:02:45 -0700
commited100166874fb4a542c5aaba933a4cca5ed72269 (patch)
tree2ff1d0fc88cbf9e10dc85c873765b4e6d06fa7e8 /guides
parentb6d5e46311d7ea59539c1f45c6ffb269eeb23912 (diff)
downloadrails-ed100166874fb4a542c5aaba933a4cca5ed72269.tar.gz
rails-ed100166874fb4a542c5aaba933a4cca5ed72269.tar.bz2
rails-ed100166874fb4a542c5aaba933a4cca5ed72269.zip
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.
Diffstat (limited to 'guides')
-rw-r--r--guides/source/caching_with_rails.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md
index c2173d0d9e..31bc478015 100644
--- a/guides/source/caching_with_rails.md
+++ b/guides/source/caching_with_rails.md
@@ -366,9 +366,9 @@ There are some common options used by all cache implementations. These can be pa
* `:namespace` - This option can be used to create a namespace within the cache store. It is especially useful if your application shares a cache with other applications.
-* `:compress` - This option can be used to indicate that compression should be used in the cache. This can be useful for transferring large cache entries over a slow network.
+* `:compress` - Enabled by default. Compresses cache entries so more data can be stored in the same memory footprint, leading to fewer cache evictions and higher hit rates.
-* `:compress_threshold` - This option is used in conjunction with the `:compress` option to indicate a threshold under which cache entries should not be compressed. This defaults to 16 kilobytes.
+* `:compress_threshold` - Defaults to 1kB. Cache entries larger than this threshold, specified in bytes, are compressed.
* `:expires_in` - This option sets an expiration time in seconds for the cache entry when it will be automatically removed from the cache.