lib/dist_redis.rb in redis-0.1.1 vs lib/dist_redis.rb in redis-0.1.2
- old
+ new
@@ -75,10 +75,35 @@
def on_each_node(command, *args)
@ring.nodes.each do |red|
red.send(command, *args)
end
end
+
+ def mset()
+
+ end
+ def mget(*keyz)
+ results = {}
+ kbn = keys_by_node(keyz)
+ kbn.each do |node, node_keyz|
+ node.mapped_mget(*node_keyz).each do |k, v|
+ results[k] = v
+ end
+ end
+ keyz.flatten.map { |k| results[k] }
+ end
+
+ def keys_by_node(*keyz)
+ keyz.flatten.inject({}) do |kbn, k|
+ node = node_for_key(k)
+ next if kbn[node] && kbn[node].include?(k)
+ kbn[node] ||= []
+ kbn[node] << k
+ kbn
+ end
+ end
+
end
if __FILE__ == $0