Class: RedisClient::Pipeline
- Inherits:
-
Multi
- Object
- Multi
- RedisClient::Pipeline
show all
- Defined in:
- lib/redis_client.rb
Instance Method Summary
collapse
Methods inherited from Multi
#_blocks, #_commands, #_retryable?, #_size, #call, #call_once, #call_once_v, #call_v
Constructor Details
#initialize(_command_builder) ⇒ Pipeline
Returns a new instance of Pipeline.
603
604
605
606
|
# File 'lib/redis_client.rb', line 603
def initialize(_command_builder)
super
@timeouts = nil
end
|
Instance Method Details
#_coerce!(results) ⇒ Object
634
635
636
637
638
639
640
641
642
643
644
|
# File 'lib/redis_client.rb', line 634
def _coerce!(results)
return results unless results
@blocks&.each_with_index do |block, index|
if block
results[index] = block.call(results[index])
end
end
results
end
|
#_empty? ⇒ Boolean
630
631
632
|
# File 'lib/redis_client.rb', line 630
def _empty?
@commands.empty?
end
|
#_timeouts ⇒ Object
626
627
628
|
# File 'lib/redis_client.rb', line 626
def _timeouts
@timeouts
end
|
#blocking_call(timeout, *command, **kwargs, &block) ⇒ Object
608
609
610
611
612
613
614
615
|
# File 'lib/redis_client.rb', line 608
def blocking_call(timeout, *command, **kwargs, &block)
command = @command_builder.generate(command, kwargs)
@timeouts ||= []
@timeouts[@commands.size] = timeout
(@blocks ||= [])[@commands.size] = block if block_given?
@commands << command
nil
end
|
#blocking_call_v(timeout, command, &block) ⇒ Object
617
618
619
620
621
622
623
624
|
# File 'lib/redis_client.rb', line 617
def blocking_call_v(timeout, command, &block)
command = @command_builder.generate(command)
@timeouts ||= []
@timeouts[@commands.size] = timeout
(@blocks ||= [])[@commands.size] = block if block_given?
@commands << command
nil
end
|