コード例 #1
0
ファイル: Predis.php プロジェクト: pietro/predis
 private function setupConnection($parameters)
 {
     if ($parameters !== null && !(is_array($parameters) || is_string($parameters))) {
         throw new ClientException('Invalid parameters type (array or string expected)');
     }
     if (is_array($parameters) && isset($parameters[0])) {
         $cluster = new ConnectionCluster();
         foreach ($parameters as $shardParams) {
             $cluster->add($this->createConnection($shardParams));
         }
         $this->setConnection($cluster);
     } else {
         $this->setConnection($this->createConnection($parameters));
     }
 }
コード例 #2
0
ファイル: Predis.php プロジェクト: naterkane/local.to
 private function setupConnection($parameters)
 {
     //echo"setupConnection: ";var_dump($parameters);echo "<br>";
     if ($parameters !== null && !(is_array($parameters) || is_string($parameters))) {
         throw new ClientException('Invalid parameters type (array or string expected)');
     }
     if (is_array($parameters) && isset($parameters[0])) {
         $cluster = new ConnectionCluster($this->_options->key_distribution);
         foreach ($parameters as $shardParams) {
             $cluster->add($this->createConnection($shardParams));
         }
         $this->setConnection($cluster);
     } else {
         $this->setConnection($this->createConnection($parameters));
     }
 }