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:
commit
09ca939eab
1 changed files with 11 additions and 2 deletions
|
@ -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?
|
||||
|
||||
|
|
Loading…
Reference in a new issue