Class: CSC::CSConnector
- Inherits:
-
Object
- Object
- CSC::CSConnector
- Defined in:
- lib/cache-server-connector.rb
Instance Attribute Summary collapse
-
#index_type ⇒ Object
writeonly
Sets the attribute index_type.
Instance Method Summary collapse
- #add_memcached(host, weight = 1, port = 11211) {|server| ... } ⇒ Object
- #add_redis(host, weight = 1, port = 6379) {|server| ... } ⇒ Object
-
#initialize ⇒ CSConnector
constructor
A new instance of CSConnector.
- #next_server(source = '') ⇒ Object
Constructor Details
#initialize ⇒ CSConnector
Returns a new instance of CSConnector.
14 15 16 17 |
# File 'lib/cache-server-connector.rb', line 14 def initialize @index_type = CSC::COUNT @servers = [] end |
Instance Attribute Details
#index_type=(value) ⇒ Object (writeonly)
Sets the attribute index_type
12 13 14 |
# File 'lib/cache-server-connector.rb', line 12 def index_type=(value) @index_type = value end |
Instance Method Details
#add_memcached(host, weight = 1, port = 11211) {|server| ... } ⇒ Object
19 20 21 22 23 |
# File 'lib/cache-server-connector.rb', line 19 def add_memcached(host, weight = 1, port = 11211) server = MemcachedServer.new(host, weight, port) yield(server) if block_given? @servers << server end |
#add_redis(host, weight = 1, port = 6379) {|server| ... } ⇒ Object
25 26 27 28 29 |
# File 'lib/cache-server-connector.rb', line 25 def add_redis(host, weight = 1, port = 6379) server = RedisServer.new(host, weight, port) yield(server) if block_given? @servers << server end |