Sha256: ac541a85842994cffc6254b104a12201a2b9d6d78455d879ccbfae49b8298f85
Contents?: true
Size: 830 Bytes
Versions: 1
Compression:
Stored size: 830 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.6 | lib/redis_cluster/node.rb |