Class: Howler::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/howler/support/config.rb

Constant Summary collapse

WHITELIST =
%w(concurrency shutdown_timeout)

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object



5
6
7
# File 'lib/howler/support/config.rb', line 5

def self.[](key)
  Howler.redis.with {|redis| redis.hget("howler:config", key.to_s) }
end

.[]=(key, value) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/howler/support/config.rb', line 9

def self.[]=(key, value)
  if value.nil?
    delete(key)
    return
  end

  Howler.redis.with {|redis| redis.hset("howler:config", key.to_s, value) }
end

.flushObject



18
19
20
21
22
23
24
25
# File 'lib/howler/support/config.rb', line 18

def self.flush
  Howler.redis.with do |redis|
    keys = redis.hkeys("howler:config") - WHITELIST
    keys.each do |key|
      redis.hdel("howler:config", key)
    end
  end
end