Sha256: 0ee3d823be29dd09cfec7eb1f4a768013dcf6bbe71f072ea8734481e49769c83
Contents?: true
Size: 653 Bytes
Versions: 3
Compression:
Stored size: 653 Bytes
Contents
require 'redis' require 'connection_pool' module Congestion class RedisPool class << self attr_accessor :redis_config attr_accessor :pool_size attr_accessor :timeout end self.redis_config = { } self.pool_size = 5 self.timeout = 5 attr_accessor :pool def self.instance @instance ||= new @redis_pool ||= ->{ @instance.pool.with{ |redis| redis } } end private 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 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
congestion-0.1.0 | lib/congestion/redis_pool.rb |
congestion-0.0.3 | lib/congestion/redis_pool.rb |
congestion-0.0.2 | lib/congestion/redis_pool.rb |