Class: AsyncStorage::RedisPool

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/async_storage/redis_pool.rb

Defined Under Namespace

Modules: ConnectionPoolLike

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ RedisPool

Returns a new instance of RedisPool.



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/async_storage/redis_pool.rb', line 17

def initialize(connection)
  if connection.respond_to?(:with)
    @connection = connection
  else
    if connection.respond_to?(:client)
      @connection = connection
    else
      @connection = ::Redis.new(*[connection].compact)
    end
    @connection.extend(ConnectionPoolLike)
  end
end