コード例 #1
0
ファイル: Command.php プロジェクト: GunioRobot/predis
 /**
  * {@inheritdoc}
  */
 public function getHash(INodeKeyGenerator $distributor)
 {
     if (isset($this->_hash)) {
         return $this->_hash;
     }
     if ($this->canBeHashed()) {
         $key = Helpers::getKeyHashablePart($this->_arguments[0]);
         $this->_hash = $distributor->generateKey($key);
         return $this->_hash;
     }
     return null;
 }
コード例 #2
0
ファイル: PredisCluster.php プロジェクト: GunioRobot/predis
 /**
  * Retrieves a connection instance from the cluster using a key.
  *
  * @param string $key Key of a Redis value.
  * @return IConnectionSingle
  */
 public function getConnectionByKey($key)
 {
     $hashablePart = Helpers::getKeyHashablePart($key);
     $keyHash = $this->_distributor->generateKey($hashablePart);
     return $this->_distributor->get($keyHash);
 }