Class: Async::Redis::Context::Nested

Inherits:
Object
  • Object
show all
Defined in:
lib/async/redis/context/nested.rb

Direct Known Subclasses

Multi, Subscribe

Instance Method Summary collapse

Constructor Details

#initialize(pool, *args) ⇒ Nested

Returns a new instance of Nested.



26
27
28
29
# File 'lib/async/redis/context/nested.rb', line 26

def initialize(pool, *args)
  @pool = pool
  @connection = pool.acquire
end

Instance Method Details

#call(command, *args) ⇒ Object



38
39
40
41
# File 'lib/async/redis/context/nested.rb', line 38

def call(command, *args)
  @connection.write_request([command, *args])
  return @connection.read_response
end

#closeObject



31
32
33
34
35
36
# File 'lib/async/redis/context/nested.rb', line 31

def close
  if @connection
    @pool.release(@connection)
    @connection = nil
  end
end