aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/cache.rb
diff options
context:
space:
mode:
authorNoah Hendrix <noahhendrix@gmail.com>2012-10-23 00:04:42 -0700
committerNoah Hendrix <noahhendrix@gmail.com>2012-10-23 00:04:42 -0700
commit81b711256591874b92683e55dc405286eb6df7a6 (patch)
tree94e91619aa8bd8161da6077098e2d269d76ae4f0 /activesupport/lib/active_support/cache.rb
parent40496430d5825f55d1b8aa063f6642b82f6c65d5 (diff)
downloadrails-81b711256591874b92683e55dc405286eb6df7a6.tar.gz
rails-81b711256591874b92683e55dc405286eb6df7a6.tar.bz2
rails-81b711256591874b92683e55dc405286eb6df7a6.zip
pass the key to the block in cache.fetch on misses
Diffstat (limited to 'activesupport/lib/active_support/cache.rb')
-rw-r--r--activesupport/lib/active_support/cache.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb
index 732ab4b7df..9a53870b3d 100644
--- a/activesupport/lib/active_support/cache.rb
+++ b/activesupport/lib/active_support/cache.rb
@@ -182,10 +182,10 @@ module ActiveSupport
# the cache with the given key, then that data is returned.
#
# If there is no such data in the cache (a cache miss), then +nil+ will be
- # returned. However, if a block has been passed, that block will be run
- # in the event of a cache miss. The return value of the block will be
- # written to the cache under the given cache key, and that return value
- # will be returned.
+ # returned. However, if a block has been passed, that block will be passed
+ # the key and executed in the event of a cache miss. The return value of the
+ # block will be written to the cache under the given cache key, and that
+ # return value will be returned.
#
# cache.write('today', 'Monday')
# cache.fetch('today') # => "Monday"
@@ -300,7 +300,7 @@ module ActiveSupport
entry.value
else
result = instrument(:generate, name, options) do |payload|
- yield
+ yield(name)
end
write(name, result, options)
result