Sha256: 30adbd9b488bb0a190885e7e236db9c9aa14ad1d1ec0e79718f29a3209938707
Contents?: true
Size: 740 Bytes
Versions: 5
Compression:
Stored size: 740 Bytes
Contents
require 'redis' require 'redis-namespace' require 'connection_pool' module Attention # A ConnectionPool of Redis connections used by {Publisher}s class RedisPool # @!visibility private attr_reader :pool # @return [RedisPool] A singleton instance of the ConnectionPool def self.instance @instance ||= new @pool ||= ->{ @instance.pool.with{ |redis| redis } } end private # As this is a singleton, +RedisPool.new+ is not public # @!visibility public # @api private def initialize pool_config = { size: Attention.options[:pool_size], timeout: Attention.options[:timeout] } @pool = ConnectionPool.new(pool_config){ Connection.new } end end end
Version data entries
5 entries across 5 versions & 1 rubygems