Class: Redis::Pipeline

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

Constant Summary collapse

BUFFER_SIZE =
50_000

Constants inherited from Redis

ALIASES, ASTERISK, BOOLEAN_PROCESSOR, BULK_COMMANDS, COLON, DISABLED_COMMANDS, DOLLAR, MINUS, MULTI_BULK_COMMANDS, OK, PLUS, REPLY_PROCESSOR

Instance Method Summary collapse

Methods inherited from Redis

#[], #[]=, #connect_to, #connect_to_server, #decr, #incr, #mapped_mget, #maybe_lock, #method_missing, #pipelined, #process_command, #quit, #raw_call_command, #read_reply, #select, #server, #set, #sort, #to_s, #type

Constructor Details

#initialize(redis) ⇒ Pipeline

Returns a new instance of Pipeline.



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

def initialize(redis)
  @redis = redis
  @commands = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Redis

Instance Method Details

#call_command(command) ⇒ Object



10
11
12
# File 'lib/redis/pipeline.rb', line 10

def call_command(command)
  @commands << command
end

#executeObject



14
15
16
17
18
# File 'lib/redis/pipeline.rb', line 14

def execute
  return if @commands.empty?
  @redis.call_command(@commands)
  @commands.clear
end