Predis\Cluster\Distributor\DistributorInterface::getByHash PHP Метод

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

Returns a node from the distributor using the computed hash of a key.
public getByHash ( mixed $hash ) : mixed
$hash mixed
Результат mixed
    public function getByHash($hash);

Usage Example

 /**
  * Returns a list of nodes from the hashring.
  *
  * @param DistributorInterface $distributor Distributor instance.
  * @param int                  $iterations  Number of nodes to fetch.
  *
  * @return array Nodes from the hashring.
  */
 protected function getNodes(DistributorInterface $distributor, $iterations = 10)
 {
     $nodes = array();
     for ($i = 0; $i < $iterations; ++$i) {
         $hash = $distributor->hash($i * $i);
         $nodes[] = $distributor->getByHash($hash);
     }
     return $nodes;
 }