Class: Redis::Pipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/redis/pipeline.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePipeline

Returns a new instance of Pipeline.



5
6
7
# File 'lib/redis/pipeline.rb', line 5

def initialize
  @commands = []
end

Instance Attribute Details

#commandsObject (readonly)

Returns the value of attribute commands.



3
4
5
# File 'lib/redis/pipeline.rb', line 3

def commands
  @commands
end

Instance Method Details

#call(*args) ⇒ Object

Starting with 2.2.1, assume that this method is called with a single array argument. Check its size for backwards compat.



11
12
13
14
15
16
17
18
19
20
# File 'lib/redis/pipeline.rb', line 11

def call(*args)
  if args.first.is_a?(Array) && args.size == 1
    command = args.first
  else
    command = args
  end

  @commands << command
  nil
end

#call_pipelined(commands, options = {}) ⇒ Object



29
30
31
32
# File 'lib/redis/pipeline.rb', line 29

def call_pipelined(commands, options = {})
  @commands.concat commands
  nil
end

#call_without_reply(command) ⇒ Object

Assume that this method is called with a single array argument. No backwards compat here, since it was introduced in 2.2.2.



24
25
26
27
# File 'lib/redis/pipeline.rb', line 24

def call_without_reply(command)
  @commands.push command
  nil
end