Skip to content

Instantly share code, notes, and snippets.

@yachi
Created May 24, 2010 04:53
Show Gist options
  • Save yachi/411539 to your computer and use it in GitHub Desktop.
Save yachi/411539 to your computer and use it in GitHub Desktop.
diff --git a/vendor/gems/ngmoco-cache-money-0.2.12/lib/cash/accessor.rb b/vendor/gems/ngmoco-cache-money-0.2.12/lib/cash/accessor.rb
index dd2d56d..88f370d 100644
--- a/vendor/gems/ngmoco-cache-money-0.2.12/lib/cash/accessor.rb
+++ b/vendor/gems/ngmoco-cache-money-0.2.12/lib/cash/accessor.rb
@@ -17,7 +17,9 @@ module Cash
hits = repository.get_multi(*keys)
if (missed_keys = keys - hits.keys).any?
missed_values = block.call(missed_keys)
- hits.merge!(missed_keys.zip(Array(missed_values)).to_hash_without_nils)
+ misses = missed_keys.zip(Array(missed_values)).to_hash_without_nils
+ misses.each { |key, missed_value| repository.add(key, missed_value, options[:ttl] || cache_config.ttl, options[:raw]) }
+ hits.merge!(misses)
end
hits
else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment