Sha256: 5ff6068543e37599e3fa9e7c003e109b2188edc12fed1e2d867a7015f73b7aab

Contents?: true

Size: 606 Bytes

Versions: 1

Compression:

Stored size: 606 Bytes

Contents

class Cachetastic::Connection
  include Singleton
  
  attr_accessor :connections
  
  def initialize
    self.connections = {}
  end
  
  def get(name)
    name = name.to_sym
    conn = self.connections[name]
    # puts "connection: #{conn}"
    # puts "connection.valid? #{conn.valid?}" if conn
    return conn if conn && conn.valid?
    # puts "we need to set up a new connection for: #{name}"
    store = Cachetastic::Stores::Base.get_options(name)["store"].camelcase
    conn = "Cachetastic::Stores::#{store}".constantize.new(name)
    self.connections[name.to_sym] = conn
    return conn
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cachetastic-1.0.6 lib/cachetastic_connection.rb