]> git.saurik.com Git - redis.git/blobdiff - client-libraries/ruby/lib/dist_redis.rb
Redis-rb sync
[redis.git] / client-libraries / ruby / lib / dist_redis.rb
index 830f8b6de3bef56ecf543e7ee959a18a5cdcd5f6..e79af4728b5ac45fb3c46f3f9eacdc3158624727 100644 (file)
@@ -2,20 +2,13 @@ require 'redis'
 require 'hash_ring'
 class DistRedis
   attr_reader :ring
-  def initialize(opts={})
-    hosts = []
-    
-    db = opts[:db] || nil
-    timeout = opts[:timeout] || nil 
-
-    raise Error, "No hosts given" unless opts[:hosts]
-
-    opts[:hosts].each do |h|
-      host, port = h.split(':')
-      hosts << Redis.new(:host => host, :port => port, :db => db, :timeout => timeout, :db => db)
+  def initialize(*servers)
+    srvs = []
+    servers.each do |s|
+      server, port = s.split(':')
+      srvs << Redis.new(:host => server, :port => port)
     end
-
-    @ring = HashRing.new hosts 
+    @ring = HashRing.new srvs
   end
   
   def node_for_key(key)