当前位置: 首页>>代码示例>>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;未经允许,请勿转载。