Method: Redstruct::ConnectionProxy#initialize

Defined in:
lib/redstruct/connection_proxy.rb

#initialize(pool_or_conn) ⇒ ConnectionProxy

Returns a new instance of ConnectionProxy.

Parameters:

  • pool_or_conn (Redis, ConnectionPool<Redis>)

    a redis connection, or a pool of redis connections

Raises:

  • (ArgumentError)

    raises an exception if the argument is not one of the required classes



18
19
20
21
22
23
24
25
26
27
# File 'lib/redstruct/connection_proxy.rb', line 18

def initialize(pool_or_conn)
  case pool_or_conn
  when ConnectionPool
    @pool = pool_or_conn
  when Redis
    @redis = pool_or_conn
  else
    raise(ArgumentError, 'requires an instance of ConnectionPool or Redis to proxy to')
  end
end