Class: RedisClient::Multi
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-client-0.12.0/lib/redis_client.rb
Direct Known Subclasses
Instance Method Summary collapse
- #_blocks ⇒ Object
- #_coerce!(results) ⇒ Object
- #_commands ⇒ Object
- #_empty? ⇒ Boolean
- #_retryable? ⇒ Boolean
- #_size ⇒ Object
- #_timeouts ⇒ Object
- #call(*command, **kwargs, &block) ⇒ Object
- #call_once(*command, **kwargs, &block) ⇒ Object
- #call_once_v(command, &block) ⇒ Object
- #call_v(command, &block) ⇒ Object
-
#initialize(command_builder) ⇒ Multi
constructor
A new instance of Multi.
Constructor Details
#initialize(command_builder) ⇒ Multi
Returns a new instance of Multi.
452 453 454 455 456 457 458 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-client-0.12.0/lib/redis_client.rb', line 452 def initialize(command_builder) @command_builder = command_builder @size = 0 @commands = [] @blocks = nil @retryable = true end |
Instance Method Details
#_blocks ⇒ Object
494 495 496 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-client-0.12.0/lib/redis_client.rb', line 494 def _blocks @blocks end |
#_coerce!(results) ⇒ Object
514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-client-0.12.0/lib/redis_client.rb', line 514 def _coerce!(results) results&.each_with_index do |result, index| if result.is_a?(CommandError) result._set_command(@commands[index + 1]) raise result end if @blocks && block = @blocks[index + 1] results[index] = block.call(result) end end results end |
#_commands ⇒ Object
490 491 492 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-client-0.12.0/lib/redis_client.rb', line 490 def _commands @commands end |
#_empty? ⇒ Boolean
502 503 504 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-client-0.12.0/lib/redis_client.rb', line 502 def _empty? @commands.size <= 2 end |
#_retryable? ⇒ Boolean
510 511 512 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-client-0.12.0/lib/redis_client.rb', line 510 def _retryable? @retryable end |
#_size ⇒ Object
498 499 500 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-client-0.12.0/lib/redis_client.rb', line 498 def _size @commands.size end |
#_timeouts ⇒ Object
506 507 508 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-client-0.12.0/lib/redis_client.rb', line 506 def _timeouts nil end |
#call(*command, **kwargs, &block) ⇒ Object
460 461 462 463 464 465 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-client-0.12.0/lib/redis_client.rb', line 460 def call(*command, **kwargs, &block) command = @command_builder.generate(command, kwargs) (@blocks ||= [])[@commands.size] = block if block_given? @commands << command nil end |
#call_once(*command, **kwargs, &block) ⇒ Object
474 475 476 477 478 479 480 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-client-0.12.0/lib/redis_client.rb', line 474 def call_once(*command, **kwargs, &block) command = @command_builder.generate(command, kwargs) @retryable = false (@blocks ||= [])[@commands.size] = block if block_given? @commands << command nil end |
#call_once_v(command, &block) ⇒ Object
482 483 484 485 486 487 488 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-client-0.12.0/lib/redis_client.rb', line 482 def call_once_v(command, &block) command = @command_builder.generate(command) @retryable = false (@blocks ||= [])[@commands.size] = block if block_given? @commands << command nil end |
#call_v(command, &block) ⇒ Object
467 468 469 470 471 472 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-client-0.12.0/lib/redis_client.rb', line 467 def call_v(command, &block) command = @command_builder.generate(command) (@blocks ||= [])[@commands.size] = block if block_given? @commands << command nil end |