class PikoMongoStore::DbFactory

Public Class Methods

create_db_connection(config) click to toggle source
# File lib/piko_mongo_store/db_factory.rb, line 28
def self.create_db_connection(config)
  config_copy = config.dup
  hosts = config_copy.delete(:hosts)
  default_config = { logger: Logger2r.for_class("Mongo::Client") }
  config_hash = Digest::MD5.hexdigest(config.inspect)
  @connections[config_hash] ||= Mongo::Client.new(hosts, default_config.merge(config_copy))
end