class Attention::RedisPool

A ConnectionPool of Redis connections used by {Publisher}s

Attributes

pool[R]

@!visibility private

Public Class Methods

instance() click to toggle source

@return [RedisPool] A singleton instance of the ConnectionPool

# File lib/attention/redis_pool.rb, line 12
def self.instance
  @instance ||= new
  @pool ||= ->{ @instance.pool.with{ |redis| redis } }
end
new() click to toggle source

As this is a singleton, RedisPool.new is not public @!visibility public @api private

# File lib/attention/redis_pool.rb, line 22
def initialize
  pool_config = {
    size: Attention.options[:pool_size],
    timeout: Attention.options[:timeout]
  }

  @pool = ConnectionPool.new(pool_config){ Connection.new }
end