public function askSlotMap(NodeConnectionInterface $connection = null)
    {
        if (!$connection && !$connection = $this->getRandomConnection()) {
            return;
        }

        $this->slotmap->reset();

        $response = $this->queryClusterNodeForSlotMap($connection);

        foreach ($response as $slots) {
            // We only support master servers for now, so we ignore subsequent
            // elements in the $slots array identifying slaves.
            list($start, $end, $master) = $slots;

            if ($master[0] === '') {
                $this->slotmap->setSlots($start, $end, (string) $connection);
            } else {
                $this->slotmap->setSlots($start, $end, "{$master[0]}:{$master[1]}");
            }
        }
    }
public function askSlotMap(NodeConnectionInterface $connection = null)
    {
        if (!$connection && !$connection = $this->getRandomConnection()) {
            return;
        }

        $this->slotmap->reset();

        $response = $this->queryClusterNodeForSlotMap($connection);

        foreach ($response as $slots) {
            // We only support master servers for now, so we ignore subsequent
            // elements in the $slots array identifying slaves.
            list($start, $end, $master) = $slots;

            if ($master[0] === '') {
                $this->slotmap->setSlots($start, $end, (string) $connection);
            } else {
                $this->slotmap->setSlots($start, $end, "{$master[0]}:{$master[1]}");
            }
        }
    }
public function askSlotMap ( NodeConnectionInterface $ connection = null ) { if ( ! $ connection && ! $ connection = $ this -> getRandomConnection ( ) ) { return ; } $ this -> slotmap -> reset ( ) ; $ response = $ this -> queryClusterNodeForSlotMap ( $ connection ) ; foreach ( $ response as $ slots ) { // We only support master servers for now, so we ignore subsequent // elements in the $slots array identifying slaves. list ( $ start , $ end , $ master ) = $ slots ; if ( $ master [ 0 ] === '' ) { $ this -> slotmap -> setSlots ( $ start , $ end , ( string ) $ connection ) ; } else { $ this -> slotmap -> setSlots ( $ start , $ end , "{$master[0]}:{$master[1]}" ) ; } } }
Generates an updated slots map fetching the cluster configuration using
the CLUSTER SLOTS command against the specified node or a random one from
the pool.

@param NodeConnectionInterface $connection Optional connection instance.
Generates an updated slots map fetching the cluster configuration using the CLUSTER SLOTS command against the specified node or a random one from the pool .