當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Client::isConnected方法代碼示例

本文整理匯總了PHP中Predis\Client::isConnected方法的典型用法代碼示例。如果您正苦於以下問題:PHP Client::isConnected方法的具體用法?PHP Client::isConnected怎麽用?PHP Client::isConnected使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Predis\Client的用法示例。


在下文中一共展示了Client::isConnected方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: connect

 /**
  * Creates a connect to Redis or Sentinel using the Predis\Client object.  It proxies the connecting and converts
  * specific client exceptions to more generic adapted ones in PSRedis
  *
  * @throws \PSRedis\Exception\ConnectionError
  */
 public function connect()
 {
     try {
         $this->predisClient = $this->predisClientFactory->createClient($this->clientType, $this->getPredisClientParameters());
         $this->predisClient->connect();
         $this->isConnected = $this->predisClient->isConnected();
     } catch (ConnectionException $e) {
         throw new ConnectionError($e->getMessage());
     }
 }
開發者ID:hemingw,項目名稱:PSRedis,代碼行數:16,代碼來源:PredisClientAdapter.php

示例2: __construct

 /**
  * Create a new Sentinel Monitor.
  *
  * If more than one sentinel server parameters are provided, the first
  * sentinel that connects will be used for retrival of information.
  *
  * @param mixed $connection_params
  */
 public function __construct($connection_params = null)
 {
     foreach ($connection_params as $connection) {
         $this->client = new Client($connection);
         // Usable connection is found
         if ($this->client->isConnected()) {
             break;
         }
     }
 }
開發者ID:andreyors,項目名稱:orm,代碼行數:18,代碼來源:SentinelMonitor.php

示例3: checkConnection

 /**
  * @return bool
  */
 public function checkConnection()
 {
     if (!$this->predis->isConnected()) {
         try {
             $this->predis->connect();
             return true;
         } catch (ConnectionException $e) {
             return false;
         }
     }
     return true;
 }
開發者ID:gerifield,項目名稱:little-red-queue,代碼行數:15,代碼來源:LittleRedQueue.php

示例4: getConnection

 /**
  * This method cannot be overridden because you need to override \Hoard\AbstractPool::getAdapterOptions().
  * @return \Predis\Client
  */
 protected final function getConnection()
 {
     // set the servers to use with this connection
     $servers = array();
     if (array_key_exists('servers', $this->adapterOptions)) {
         $servers = $this->adapterOptions['servers'];
     }
     // first time connect
     if (null == $this->connection || !$this->connection->isConnected()) {
         $this->connection = new PredisClient($servers);
     }
     return $this->connection;
 }
開發者ID:nlmdev,項目名稱:hoard,代碼行數:17,代碼來源:Redis.php

示例5: testIsConnectedChecksConnectionState

 /**
  * @group disconnected
  */
 public function testIsConnectedChecksConnectionState()
 {
     $connection = $this->getMock('Predis\\Connection\\ConnectionInterface');
     $connection->expects($this->once())->method('isConnected');
     $client = new Client($connection);
     $client->isConnected();
 }
開發者ID:rodrigopbel,項目名稱:ong,代碼行數:10,代碼來源:ClientTest.php

示例6: isConnected

 /**
  * @inheritdoc
  */
 public function isConnected()
 {
     return isset($this->client) && $this->client->isConnected();
 }
開發者ID:tonicospinelli,項目名稱:disque-php,代碼行數:7,代碼來源:Predis.php


注:本文中的Predis\Client::isConnected方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。