module Modis

Constants

VERSION

Attributes

config[R]
connection_pool[W]
connection_pool_size[W]
connection_pool_timeout[W]
redis_options[W]

Public Class Methods

configure() { |config| ... } click to toggle source
# File lib/modis/configuration.rb, line 4
def self.configure
  yield config
end
connection_pool() click to toggle source
# File lib/modis.rb, line 38
def connection_pool
  return @connection_pool if @connection_pool

  @mutex.synchronize do
    options = { size: connection_pool_size, timeout: connection_pool_timeout }
    @connection_pool = ConnectionPool.new(options) { Redis.new(redis_options) }
  end
end
connection_pool_size() click to toggle source
# File lib/modis.rb, line 30
def connection_pool_size
  @connection_pool_size ||= 5
end
connection_pool_timeout() click to toggle source
# File lib/modis.rb, line 34
def connection_pool_timeout
  @connection_pool_timeout ||= 5
end
redis_options() click to toggle source
# File lib/modis.rb, line 26
def redis_options
  @redis_options ||= {}
end
with_connection() { |connection| ... } click to toggle source
# File lib/modis.rb, line 47
def with_connection
  connection_pool.with { |connection| yield(connection) }
end