lib/upperkut/redis_pool.rb in upperkut-0.7.0 vs lib/upperkut/redis_pool.rb in upperkut-0.7.1
- old
+ new
@@ -1,18 +1,17 @@
require 'connection_pool'
require 'redis'
module Upperkut
class RedisPool
-
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'],
+ 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
def initialize(options)
@options = DEFAULT_OPTIONS.merge(options)
@@ -20,10 +19,10 @@
@size = @options.delete(:size)
@pool_timeout = @options.delete(:pool_timeout)
end
def create
- ConnectionPool.new(:timeout => @pool_timeout, :size => @size) do
+ ConnectionPool.new(timeout: @pool_timeout, size: @size) do
Redis.new(@options)
end
end
end
end