lib/daijobu/adapters/mem_cache.rb in sander6-daijobu-0.1.1 vs lib/daijobu/adapters/mem_cache.rb in sander6-daijobu-0.2.0

- old
+ new

@@ -6,15 +6,27 @@ def initialize(store) @store = store end - def get(key) - @store.get(key, true) + def get(*keys) + if keys.size == 0 + nil + elsif keys.size == 1 + get_one(keys.first) + else + keys.inject({}) { |agg, key| agg.merge(key => get_one(key)) } + end end def set(key, value) - @store.set(key, value, 0, true) + @store.add(key, value, 0, true) + end + + private + + def get_one(key) + @store.get(key, true) end end end \ No newline at end of file