Predis\Cluster\StrategyInterface::getSlot PHP Метод

getSlot() публичный Метод

Returns a slot for the given command used for clustering distribution or NULL when this is not possible.
public getSlot ( Predis\Command\CommandInterface $command ) : integer
$command Predis\Command\CommandInterface Command instance.
Результат integer
    public function getSlot(CommandInterface $command);

Usage Example

Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function getConnectionByCommand(CommandInterface $command)
 {
     $slot = $this->strategy->getSlot($command);
     if (!isset($slot)) {
         throw new NotSupportedException("Cannot use '{$command->getId()}' over clusters of connections.");
     }
     $node = $this->distributor->getBySlot($slot);
     return $node;
 }