lib/redis/distributed_store.rb in redis-store-1.0.0.1 vs lib/redis/distributed_store.rb in redis-store-1.1.0.rc
- old
+ new
@@ -1,12 +1,15 @@
+require 'redis/distributed'
+
class Redis
class DistributedStore < Distributed
+ @@timeout = 5
attr_reader :ring
def initialize(addresses, options = { })
nodes = addresses.map do |address|
- ::Redis::Store.new address
+ ::Redis::Store.new _merge_options(address, options)
end
_extend_namespace options
@ring = Redis::HashRing.new nodes
end
@@ -32,8 +35,12 @@
private
def _extend_namespace(options)
@namespace = options[:namespace]
extend ::Redis::Store::Namespace if @namespace
+ end
+
+ def _merge_options(address, options)
+ address.merge(:timeout => options[:timeout] || @@timeout)
end
end
end