aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-02-01 17:03:17 -0200
committerRafael França <rafaelmfranca@gmail.com>2016-02-01 17:03:17 -0200
commit04dea729e3151b57ee15d88a38100b2951b84335 (patch)
treeb92c42f29b66baeefec5d6a3605ad89265796f47 /actionpack/lib
parent2341a8e2401f782db5f133c3a34bc487d299ebdc (diff)
parentb3427c662e337c2a3aa8d944b0f012641e67a4bd (diff)
downloadrails-04dea729e3151b57ee15d88a38100b2951b84335.tar.gz
rails-04dea729e3151b57ee15d88a38100b2951b84335.tar.bz2
rails-04dea729e3151b57ee15d88a38100b2951b84335.zip
Merge pull request #23151 from maclover7/fix-23148
Add documentation for #17573
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/http/cache.rb8
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)}")