rails/rails — pull request #8013 by noahhendrix (2012-10-23 07:14:24+00:00)
Title: Pass key to block in cache.fetch on miss

It would be convient to pass the key to the block on cache.fetch when their is a miss. When I use cache.fetch I always have to store the key I'm attempting to write away to pass to the computation function:

```ruby
query = params[:q]

Rails.cache.fetch(query) do
ExpensiveOperation.execute(query)
end
```

vs. after my commit:

```ruby
Rails.cache.fetch(params[:q]) do |query|
ExpensiveOperation.execute(query)
end
```

This is low-risk, medium-reward commit. Existing code will *just work* if the block doesn't receive a variable and future code will be cleaner in this very common pattern.