Class: Upperkut::RedisPool
- Inherits:
-
Object
- Object
- Upperkut::RedisPool
- Defined in:
- lib/upperkut/redis_pool.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ pool_timeout: 1, # pool related option size: 2, # pool related option connect_timeout: 0.2, read_timeout: 5.0, write_timeout: 0.5, url: ENV['REDIS_URL'] }.freeze
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(options) ⇒ RedisPool
constructor
A new instance of RedisPool.
Constructor Details
#initialize(options) ⇒ RedisPool
Returns a new instance of RedisPool.
15 16 17 18 19 20 21 |
# File 'lib/upperkut/redis_pool.rb', line 15 def initialize() @options = DEFAULT_OPTIONS.merge() # Extract pool related options @size = @options.delete(:size) @pool_timeout = @options.delete(:pool_timeout) end |
Instance Method Details
#create ⇒ Object
23 24 25 26 27 |
# File 'lib/upperkut/redis_pool.rb', line 23 def create ConnectionPool.new(timeout: @pool_timeout, size: @size) do Redis.new(@options) end end |