Cache Server Connector

======================

A simple cache server connector for Memcached and Redis server.

Index Type

  • ROUND
  • HASH
  • WEIGHT
  • COUNT

It's just a connector, it won't provide data access method like set or replace etc.

Installation

gem install cache-server-connector

Usage

require 'cache-server-connector'

csc = CSC::CSConnector.new

csc.add_memcached('127.0.0.1', 1)
csc.add_redis('127.0.0.1', 3)

#COUNT
100.times do |_| 
  puts csc.next_server
end

#HASH
csc.index_type = CSC::HASH

100.times do |_| 
  puts csc.next_server(Time.new.to_s) 
end

#WEIGHT                                                            
csc.index_type = CSC::WEIGHT

100.times do |_| 
  puts csc.next_server
end