diff options
author | Carlos Donderis <cdonderis@gmail.com> | 2018-10-16 11:43:38 +0900 |
---|---|---|
committer | Carlos Donderis <cdonderis@gmail.com> | 2018-10-16 11:43:38 +0900 |
commit | cae1b2ce8612d87687c44a282eb469599baabdc9 (patch) | |
tree | 1c2a6c01bfdd5cd2d6bb633b7e3a023bd7e78c23 /activesupport | |
parent | bfea0af4ba7d717d6a065b4370e3ccfd8869dde6 (diff) | |
download | rails-cae1b2ce8612d87687c44a282eb469599baabdc9.tar.gz rails-cae1b2ce8612d87687c44a282eb469599baabdc9.tar.bz2 rails-cae1b2ce8612d87687c44a282eb469599baabdc9.zip |
Extends documentation for ActiveSupport::Cache#fetch_multi [ci skip]
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/cache.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index a5d0c52b13..68c03f294c 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? |