module ExcessFlow::RedisConnection

ExcessFlow::RedisConnection

Wrapper around ConnectionPool and Redis to provide connectivity to Redis with desired configuration and sane connection pool

Public Instance Methods

connection_options() click to toggle source
# File lib/excess_flow/redis_connection.rb, line 31
def connection_options
  {
    url: redis_url,
    sentinels: sentinels
  }.delete_if { |_k, v| v.nil? || v.empty? }
end
connection_pool() click to toggle source
# File lib/excess_flow/redis_connection.rb, line 25
def connection_pool
  @connection_pool = ConnectionPool.new(connection_pool_options) do
    Redis.new(connection_options)
  end
end
connection_pool_options() click to toggle source
# File lib/excess_flow/redis_connection.rb, line 38
def connection_pool_options
  {
    size: pool_size,
    timeout: connection_timeout
  }
end
connection_timeout() click to toggle source
# File lib/excess_flow/redis_connection.rb, line 45
def connection_timeout
  ExcessFlow.configuration.connection_timeout
end
pool_size() click to toggle source
# File lib/excess_flow/redis_connection.rb, line 49
def pool_size
  ExcessFlow.configuration.connection_pool
end
redis_url() click to toggle source
# File lib/excess_flow/redis_connection.rb, line 53
def redis_url
  ExcessFlow.configuration.redis_url
end
sentinels() click to toggle source
# File lib/excess_flow/redis_connection.rb, line 57
def sentinels
  ExcessFlow.configuration.sentinels
end