diff options
author | Jon Moss <me@jonathanmoss.me> | 2016-01-20 19:58:25 -0500 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2016-02-01 13:28:30 -0500 |
commit | b3427c662e337c2a3aa8d944b0f012641e67a4bd (patch) | |
tree | 3fb3c9dd478b721a020fcb88105a814e8d533f3b /actionpack/lib/action_dispatch/http/cache.rb | |
parent | 9aa425f75fac376ea1c268ad5196ddb2dd7ed387 (diff) | |
download | rails-b3427c662e337c2a3aa8d944b0f012641e67a4bd.tar.gz rails-b3427c662e337c2a3aa8d944b0f012641e67a4bd.tar.bz2 rails-b3427c662e337c2a3aa8d944b0f012641e67a4bd.zip |
Add documentation for #17573
Fixes some parts of #23148.
[ci skip]
Diffstat (limited to 'actionpack/lib/action_dispatch/http/cache.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/http/cache.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/http/cache.rb b/actionpack/lib/action_dispatch/http/cache.rb index 0f7898a3f8..4bd727c14e 100644 --- a/actionpack/lib/action_dispatch/http/cache.rb +++ b/actionpack/lib/action_dispatch/http/cache.rb @@ -80,6 +80,14 @@ module ActionDispatch set_header DATE, utc_time.httpdate end + # This method allows you to set the ETag for cached content, which + # will be returned to the end user. + # + # By default, Action Dispatch sets all ETags to be weak. + # This ensures that if the content changes only semantically, + # the whole page doesn't have to be regenerated from scratch + # by the web server. With strong ETags, pages are compared + # byte by byte, and are regenerated only if they are not exactly equal. def etag=(etag) key = ActiveSupport::Cache.expand_cache_key(etag) super %(W/"#{Digest::MD5.hexdigest(key)}") |