Please sign in to comment.
Allow fetching multiple values from the cache at once
Add a simple API for fetching a list of entries from the cache, where any missing entries are computed by a supplied block.
- Loading branch information...
Showing with 61 additions and 1 deletion.
|@@ -1,3 +1,15 @@|
|* No changes.|
|* Add a `fetch_multi` method to the cache stores. The method provides|
|an easy to use API for fetching multiple values from the cache.|
|# Calculating scores is expensive, so we only do it for posts|
|# that have been updated. Cache keys are automatically extracted|
|# from objects that define a #cache_key method.|
|scores = Rails.cache.fetch_multi(*posts) do |post||
|Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/activesupport/CHANGELOG.md) for previous changes.|