1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #34056 from CaDs/CaDs-extend_documentation_for_fetch_multi

Extend doc for ActiveSupport::Cache#fetch_multi
This commit is contained in:
Richard Schneeman 2018-10-16 06:59:17 -05:00 committed by GitHub
commit 09ca939eab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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?