class Congestion::RedisPool

Attributes

pool_size[RW]
redis_config[RW]
timeout[RW]
pool[RW]

Public Class Methods

instance() click to toggle source
# File lib/congestion/redis_pool.rb, line 18
def self.instance
  @instance ||= new
  @redis_pool ||= ->{ @instance.pool.with{ |redis| redis } }
end
new() click to toggle source
# File lib/congestion/redis_pool.rb, line 24
def initialize
  pool_config = { size: self.class.pool_size, timeout: self.class.timeout }

  self.pool = ConnectionPool.new(pool_config) do
    Redis.new self.class.redis_config
  end
end