Module: Linger::Connections

Included in:
Linger
Defined in:
lib/linger/connections.rb

Instance Method Summary collapse

Instance Method Details

#clear_allObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/linger/connections.rb', line 14

def clear_all
  Linger.instrument :meta, message: "Connections all cleared" do
    connections.each_value do |connection|
      if Linger.namespace
        keys = connection.keys("#{Linger.namespace}:*")
        connection.del keys if keys.any?
      else
        connection.flushdb
      end
    end
  end
end

#configured_for(name) ⇒ Object



8
9
10
11
12
# File 'lib/linger/connections.rb', line 8

def configured_for(name)
  connections[name] ||= Linger.instrument :meta, message: "Connected to #{name}" do
    connector.call configurator.config_for("redis/#{name}")
  end
end