lib/cachetastic_connection.rb in cachetastic-1.0.6 vs lib/cachetastic_connection.rb in cachetastic-1.0.7

- old
+ new

@@ -1,20 +1,21 @@ +# This class caches store objects for each cache in the system. class Cachetastic::Connection include Singleton attr_accessor :connections def initialize self.connections = {} end + # Takes the name of the cache and returns back the store object associated with the cache. + # If the store object doesn't exist of the the store is no longer valid a new one is + # created and returned. 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 \ No newline at end of file