aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorRichard Schneeman <richard.schneeman+no-recruiters@gmail.com>2018-10-16 06:59:17 -0500
committerGitHub <noreply@github.com>2018-10-16 06:59:17 -0500
commit09ca939eabc8b0cda865ecf2893c48800a7c51e3 (patch)
tree39af898fab634d79da2a1a87b66949edf45a8f1f /activesupport
parentb0b0cd1fd77af3eec8b2b8760bace2572e04a3a3 (diff)
parentcae1b2ce8612d87687c44a282eb469599baabdc9 (diff)
downloadrails-09ca939eabc8b0cda865ecf2893c48800a7c51e3.tar.gz
rails-09ca939eabc8b0cda865ecf2893c48800a7c51e3.tar.bz2
rails-09ca939eabc8b0cda865ecf2893c48800a7c51e3.zip
Merge pull request #34056 from CaDs/CaDs-extend_documentation_for_fetch_multi
Extend doc for ActiveSupport::Cache#fetch_multi
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/cache.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb
index 2be79d86dd..e8518645d9 100644
--- a/activesupport/lib/active_support/cache.rb
+++ b/activesupport/lib/active_support/cache.rb
@@ -411,8 +411,6 @@ module ActiveSupport
# to the cache. If you do not want to write the cache when the cache is
# not found, use #read_multi.
#
- # Options are passed to the underlying cache implementation.
- #
# Returns a hash with the data for each of the names. For example:
#
# cache.write("bim", "bam")
@@ -422,6 +420,17 @@ module ActiveSupport
# # => { "bim" => "bam",
# # "unknown_key" => "Fallback value for key: unknown_key" }
#
+ # Options are passed to the underlying cache implementation. For example:
+ #
+ # cache.fetch_multi("fizz", expires_in: 5.seconds) do |key|
+ # "buzz"
+ # end
+ # # => {"fizz"=>"buzz"}
+ # cache.read("fizz")
+ # # => "buzz"
+ # sleep(6)
+ # cache.read("fizz")
+ # # => nil
def fetch_multi(*names)
raise ArgumentError, "Missing block: `Cache#fetch_multi` requires a block." unless block_given?