Class: Redis::Pipeline

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

Constant Summary collapse

BUFFER_SIZE =
50_000

Constants inherited from Redis

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

Instance Method Summary collapse

Methods inherited from Redis

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

Constructor Details

#initialize(redis) ⇒ Pipeline

Returns a new instance of Pipeline.



7
8
9
10
# File 'lib/redis_ext/pipeline.rb', line 7

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



12
13
14
# File 'lib/redis_ext/pipeline.rb', line 12

def call_command(command)
  @commands << command
end

#executeObject



16
17
18
19
# File 'lib/redis_ext/pipeline.rb', line 16

def execute
  @redis.call_command(@commands)
  @commands.clear
end