Parent

Namespace

Redis::Pipeline

Attributes

futures[R]

Public Class Methods

new() click to toggle source
# File lib/redis/pipeline.rb, line 11
def initialize
  @with_reconnect = true
  @shutdown = false
  @futures = []
end

Public Instance Methods

call(command, &block) click to toggle source
# File lib/redis/pipeline.rb, line 29
def call(command, &block)
  # A pipeline that contains a shutdown should not raise ECONNRESET when
  # the connection is gone.
  @shutdown = true if command.first == :shutdown
  future = Future.new(command, block)
  @futures << future
  future
end
call_pipeline(pipeline) click to toggle source
# File lib/redis/pipeline.rb, line 38
def call_pipeline(pipeline)
  @shutdown = true if pipeline.shutdown?
  @futures.concat(pipeline.futures)
  nil
end
commands() click to toggle source
# File lib/redis/pipeline.rb, line 44
def commands
  @futures.map { |f| f._command }
end
finish(replies, &blk) click to toggle source
# File lib/redis/pipeline.rb, line 57
def finish(replies, &blk)
  if blk
    futures.each_with_index.map do |future, i|
      future._set(blk.call(replies[i]))
    end
  else
    futures.each_with_index.map do |future, i|
      future._set(replies[i])
    end
  end
end
shutdown?() click to toggle source
# File lib/redis/pipeline.rb, line 25
def shutdown?
  @shutdown
end
with_reconnect(val=true) click to toggle source
# File lib/redis/pipeline.rb, line 48
def with_reconnect(val=true)
  @with_reconnect = false unless val
  yield
end
with_reconnect?() click to toggle source
# File lib/redis/pipeline.rb, line 17
def with_reconnect?
  @with_reconnect
end
without_reconnect(&blk) click to toggle source
# File lib/redis/pipeline.rb, line 53
def without_reconnect(&blk)
  with_reconnect(false, &blk)
end
without_reconnect?() click to toggle source
# File lib/redis/pipeline.rb, line 21
def without_reconnect?
  !@with_reconnect
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.