# File lib/redis/distributed_store.rb, line 8 def initialize(addresses, options = { }) nodes = addresses.map do |address| ::Redis::Store.new _merge_options(address, options) end _extend_namespace options @ring = Redis::HashRing.new nodes end
# File lib/redis/distributed_store.rb, line 28 def get(key, options = nil) node_for(key).get(key, options) end
# File lib/redis/distributed_store.rb, line 16 def nodes ring.nodes end
# File lib/redis/distributed_store.rb, line 20 def reconnect nodes.each {|node| node.reconnect } end
# File lib/redis/distributed_store.rb, line 24 def set(key, value, options = nil) node_for(key).set(key, value, options) end
# File lib/redis/distributed_store.rb, line 32 def setnx(key, value, options = nil) node_for(key).setnx(key, value, options) end
# File lib/redis/distributed_store.rb, line 37 def _extend_namespace(options) @namespace = options[:namespace] extend ::Redis::Store::Namespace if @namespace end
# File lib/redis/distributed_store.rb, line 42 def _merge_options(address, options) address.merge(:timeout => options[:timeout] || @@timeout) end