@@ 445-470 (lines=26) @@ | ||
442 | if (sizeof($channels)) { |
|
443 | $this->sendCommand($name, $channels, $opcb); |
|
444 | } |
|
445 | } elseif ($name === 'UNSUBSCRIBEREAL') { |
|
446 | /* Race-condition-free UNSUBSCRIBE */ |
|
447 | $old = $this->subscribeCb; |
|
448 | $this->sendCommand('UNSUBSCRIBE', $args, function ($redis) use ($cb, $args, $old) { |
|
449 | if (!$redis) { |
|
450 | $cb($redis); |
|
451 | return; |
|
452 | } |
|
453 | foreach ($args as $arg) { |
|
454 | if (!isset($this->subscribeCb[$arg])) { |
|
455 | continue; |
|
456 | } |
|
457 | foreach ($old[$arg] as $oldcb) { |
|
458 | CallbackWrapper::removeFromArray($this->subscribeCb[$arg], $oldcb); |
|
459 | } |
|
460 | if (!sizeof($this->subscribeCb[$arg])) { |
|
461 | unset($this->subscribeCb[$arg]); |
|
462 | } |
|
463 | } |
|
464 | if ($cb !== null) { |
|
465 | $cb($this); |
|
466 | } |
|
467 | }); |
|
468 | } elseif ($name === 'PUNSUBSCRIBE') { |
|
469 | $channels = []; |
|
470 | foreach ($args as $arg) { |
|
471 | if (!is_array($arg)) { |
|
472 | $arg = [$arg]; |
|
473 | } |
|
@@ 489-514 (lines=26) @@ | ||
486 | if (sizeof($channels)) { |
|
487 | $this->sendCommand($name, $channels, $opcb); |
|
488 | } |
|
489 | } elseif ($name === 'PUNSUBSCRIBEREAL') { |
|
490 | /* Race-condition-free PUNSUBSCRIBE */ |
|
491 | $old = $this->psubscribeCb; |
|
492 | $this->sendCommand('PUNSUBSCRIBE', $args, function ($redis) use ($cb, $args, $old) { |
|
493 | if (!$redis) { |
|
494 | $cb($redis); |
|
495 | return; |
|
496 | } |
|
497 | foreach ($args as $arg) { |
|
498 | if (!isset($this->psubscribeCb[$arg])) { |
|
499 | continue; |
|
500 | } |
|
501 | foreach ($old[$arg] as $oldcb) { |
|
502 | CallbackWrapper::removeFromArray($this->psubscribeCb[$arg], $oldcb); |
|
503 | } |
|
504 | if (!sizeof($this->psubscribeCb[$arg])) { |
|
505 | unset($this->psubscribeCb[$arg]); |
|
506 | } |
|
507 | } |
|
508 | if ($cb !== null) { |
|
509 | $cb($this); |
|
510 | } |
|
511 | }); |
|
512 | } else { |
|
513 | if ($name === 'MGET') { |
|
514 | $this->resultTypeStack->push(static::RESULT_TYPE_ARGSVALS); |
|
515 | $this->argsStack->push($args); |
|
516 | } elseif ($name === 'HMGET') { |
|
517 | $this->resultTypeStack->push(static::RESULT_TYPE_ARGSVALS); |