aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAnatoly Mikhaylov <mikhailov@users.noreply.github.com>2018-09-03 14:38:56 +0100
committerAnatoly <mikhailov.anatoly@gmail.com>2018-09-03 20:04:54 +0100
commit8634b4688913772468b850922d908d2c7b5b6422 (patch)
tree649cfcfb207234d5e8135a8f165a06da54653138 /actionpack
parente6ba30efbf107954db2707410d78d77680d69995 (diff)
downloadrails-8634b4688913772468b850922d908d2c7b5b6422.tar.gz
rails-8634b4688913772468b850922d908d2c7b5b6422.tar.bz2
rails-8634b4688913772468b850922d908d2c7b5b6422.zip
Update documentation to ActionController::ConditionalGet
Two implemented but undocumented features are to help indicate that cache is fresh for 3 hours, and it may continue to be served stale for up to an additional 60 seconds to parallel requests for the same resource or up to 5 minutes while errors are being returned back while the initial synchronous revalidation is attempted.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/metal/conditional_get.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/metal/conditional_get.rb b/actionpack/lib/action_controller/metal/conditional_get.rb
index 4be4557e2c..d6911ee2b5 100644
--- a/actionpack/lib/action_controller/metal/conditional_get.rb
+++ b/actionpack/lib/action_controller/metal/conditional_get.rb
@@ -230,6 +230,12 @@ module ActionController
# This method will overwrite an existing Cache-Control header.
# See https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html for more possibilities.
#
+ # HTTP Cache-Control Extensions for Stale Content. See https://tools.ietf.org/html/rfc5861
+ # It helps to cache an asset and serve it while is being revalidated and/or returning with an error.
+ #
+ # expires_in 3.hours, public: true, stale_while_revalidate: 60.seconds
+ # expires_in 3.hours, public: true, stale_while_revalidate: 60.seconds, stale_if_error: 5.minutes
+ #
# The method will also ensure an HTTP Date header for client compatibility.
def expires_in(seconds, options = {})
response.cache_control.merge!(