module Kredis::Connections
def clear_all
def clear_all Kredis.instrument :meta, message: "Connections all cleared" do connections.each_value do |connection| if Kredis.namespace keys = connection.keys("#{Kredis.namespace}:*") connection.del keys if keys.any? else connection.flushdb end end end end
def configured_for(name)
def configured_for(name) connections[name] ||= Kredis.instrument :meta, message: "Connected to #{name}" do if configurator.root.join("config/redis/#{name}.yml").exist? connector.call configurator.config_for("redis/#{name}") elsif name == :shared Redis.new url: ENV.fetch("REDIS_URL", DEFAULT_REDIS_URL), timeout: DEFAULT_REDIS_TIMEOUT else raise "No configuration found for #{name}" end end end