def self.init(yaml_file = nil)
yaml_file = File.join(Rails.root, 'config', 'memcached.yml')
if File.exists?(yaml_file)
yaml = YAML.load_file(yaml_file)
defaults = (yaml.delete('defaults') || {}).symbolize_keys
config = (yaml[Rails.env] || {}).symbolize_keys
if not config.empty? and not config[:disabled]
if config[:servers]
opts = defaults.merge(config.symbolize_keys)
Object.const_set('CACHE', Memcache.new(opts))
else
config.each do |connection, opts|
opts = defaults.merge(opts.symbolize_keys)
Memcache.pool[connection] = Memcache.new(opts)
end
end
end
end
end