Class: RedisRb::Pipeline
Constant Summary collapse
- BUFFER_SIZE =
50_000
Constants inherited from Client
Client::ALIASES, Client::ASTERISK, 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
- #call_command(command) ⇒ Object
- #execute ⇒ Object
-
#initialize(redis) ⇒ Pipeline
constructor
A new instance of Pipeline.
Methods inherited from Client
#[], #[]=, #connect_to, #connect_to_server, #decr, #exec, #incr, #mapped_mget, #maybe_lock, #method_missing, #mset, #msetnx, #multi, #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 RedisRb::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 |
#execute ⇒ Object
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 |