Sha256: 4c708386897831a8819f3378b46bf2e0b908ce2974793c0bc4e26fbfe3ea9cca
Contents?: true
Size: 832 Bytes
Versions: 1
Compression:
Stored size: 832 Bytes
Contents
module RedisCluster class Node # slots is a range array: [1..100, 300..500] attr_accessor :slots # # basic requires: # {host: xxx.xxx.xx.xx, port: xxx} # redis cluster don't support select db, use default 0 # def initialize(opts) @options = opts @slots = [] end def name "#{@options[:host]}:#{@options[:port]}" end def host_hash {host: @options[:host], port: @options[:port]} end def has_slot?(slot) slots.any? {|range| range.include? slot } end def asking execute(:asking) end def execute(method, args) connection.send(method, *args) end def connection @connection ||= self.class.redis(@options) end def self.redis(options) ::Redis.new(options) end end # end Node end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
redis_cluster-0.1.7 | lib/redis_cluster/node.rb |