Class: Redis::Pipeline

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

Constant Summary collapse

BUFFER_SIZE =
50_000

Constants inherited from Client

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

Instance Method Summary collapse

Methods inherited from Client

#[], #[]=, #connect_to, #connect_to_server, #decr, #exec, #get_size, #incr, #mapped_mget, #mapped_mset, #mapped_msetnx, #maybe_lock, #method_missing, #mset, #msetnx, #multi, #pipelined, #process_command, #quit, #raw_call_command, #read_reply, #select, #server, #set, #set_with_expire, #sort, #subscribe, #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::Client

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