# 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 29 def get(key, options = nil) node_for(key).get(key, options) end
# File lib/redis/distributed_store.rb, line 17 def nodes ring.nodes end
# File lib/redis/distributed_store.rb, line 21 def reconnect nodes.each {|node| node.reconnect } end
# File lib/redis/distributed_store.rb, line 25 def set(key, value, options = nil) node_for(key).set(key, value, options) end
# File lib/redis/distributed_store.rb, line 33 def setnx(key, value, options = nil) node_for(key).setnx(key, value, options) end
# File lib/redis/distributed_store.rb, line 38 def _extend_namespace(options) @namespace = options[:namespace] extend ::Redis::Store::Namespace if @namespace end
# File lib/redis/distributed_store.rb, line 43 def _merge_options(address, options) address.merge({ :timeout => options[:timeout] || @@timeout, :namespace => options[:namespace] }) end