Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Take a shot at multi_get

  • Loading branch information...
commit 4e3414039af7405ee0db379254cea54d7b478eae 1 parent b5e0bea
@joshuabates joshuabates authored
Showing with 10 additions and 1 deletion.
  1. +9 −0 lib/cacher.rb
  2. +1 −1  lib/cacher/version.rb
View
9 lib/cacher.rb
@@ -144,6 +144,15 @@ def get(key, options={}, &blk)
unmarshal_value(cached)
end
+ def get_multi(keys)
+ cached_results = cache.read_multi(keys.map { |k| prepare_key(k) }).inject({}) do |results, (key, value)|
+ results[key] = unmarshal_value(value)
+ results
+ end
+
+ keys.map { |key| cached_results[prepare_key(key)] }
+ end
+
def set(key, options={}, &blk)
val = do_block(&blk)
cache_set(key, marshal_value(val), options)
View
2  lib/cacher/version.rb
@@ -1,5 +1,5 @@
module Cacher
def self.version
- '0.2.0'
+ '0.2.1'
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.