Sha256: 6eef105b1f79992f66fbd10c190aefb862b57c2290135470b862d02e5eb05ef8

Contents?: true

Size: 451 Bytes

Versions: 2

Compression:

Stored size: 451 Bytes

Contents

class FastCache::Connection
  include FastCache::Memcache::Protocol

  attr_accessor :router

  CONNECTION_OPTIONS = {
    :router => FastCache::BasicRouter}

  def initialize(nodes, opts = nil)
    opts = CONNECTION_OPTIONS.merge(opts || {})
    @nodes = nodes.map {|(host, port)| FastCache::Memcache::Node.new(host, port)}
    @router = opts[:router].new(@nodes)
  end

  def close_all_connections
    @nodes.each do |node| node.close end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
binary42-fastcache-0.2 lib/fastcache/interface/connection.rb
binary42-fastcache-0.3 lib/fastcache/interface/connection.rb