class Cachetastic::Stores::Base attr_reader :all_options attr_reader :store_options attr_reader :servers attr_reader :name attr_reader :logging attr_reader :logger def initialize(name) @name = name configure setup if self.debug? self.logger.debug(self.name, :self, self.inspect) self.logger.debug(self.name, :options, self.all_options.inspect) end end def valid? false end [:setup, :set, :get, :delete, :expire_all, :stats].each do |meth| define_method(meth) do |*args| raise MethodNotImplemented.new(meth) end end def debug? ivar_cache(:debug) do (self.all_options["debug"] == true || false) end end def configure @all_options = Cachetastic::Stores::Base.get_options(self.name) @store_options = (self.all_options["store_options"] || {}) @servers = self.all_options["servers"] @logging = (self.all_options["logging"] || {}) @logger = Cachetastic::Logger.new(self.logging, self.name) end class << self def get_options(name) options = app_config.cachetastic_default_options options.merge!(app_config.send(name.methodize + "_options") || {}) options = {"store" => "local_memory"}.merge(options) options end end end