当前位置: 首页>>代码示例>>PHP>>正文


PHP resource::ping方法代码示例

本文整理汇总了PHP中resource::ping方法的典型用法代码示例。如果您正苦于以下问题:PHP resource::ping方法的具体用法?PHP resource::ping怎么用?PHP resource::ping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在resource的用法示例。


在下文中一共展示了resource::ping方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: close

 /**
  * Close
  *
  * Releases locks and closes connection.
  *
  * @return	bool
  */
 public function close()
 {
     if (isset($this->_redis)) {
         try {
             if ($this->_redis->ping() === '+PONG') {
                 isset($this->_lock_key) && $this->_redis->delete($this->_lock_key);
                 if (!$this->_redis->close()) {
                     return FALSE;
                 }
             }
         } catch (RedisException $e) {
         }
         $this->_redis = NULL;
         return TRUE;
     }
     return TRUE;
 }
开发者ID:evolutionscript,项目名称:CI_Session,代码行数:24,代码来源:Session_redis_driver.php

示例2: close

 /**
  * Close
  *
  * Releases locks and closes connection.
  *
  * @return	bool
  */
 public function close()
 {
     if (isset($this->_redis)) {
         try {
             if ($this->_redis->ping() === '+PONG') {
                 isset($this->_lock_key) && $this->_redis->delete($this->_lock_key);
                 if (!$this->_redis->close()) {
                     return $this->_failure;
                 }
             }
         } catch (RedisException $e) {
             log_message('error', 'Session: Got RedisException on close(): ' . $e->getMessage());
         }
         $this->_redis = NULL;
         return $this->_success;
     }
     return $this->_success;
 }
开发者ID:wms-code,项目名称:CodeIgniter-admin,代码行数:25,代码来源:Session_redis_driver.php

示例3: close

 /**
  * Close
  *
  * Releases locks and closes connection.
  *
  * @return	bool
  */
 public function close()
 {
     if (isset($this->_redis)) {
         try {
             if ($this->_redis->ping() === '+PONG') {
                 $this->_release_lock();
                 if ($this->_redis->close() === FALSE) {
                     return $this->_fail();
                 }
             }
         } catch (RedisException $e) {
             log_message('error', 'Session: Got RedisException on close(): ' . $e->getMessage());
         }
         $this->_redis = NULL;
         return $this->_success;
     }
     return $this->_success;
 }
开发者ID:xiaokunliu,项目名称:php_project,代码行数:25,代码来源:Session_redis_driver.php

示例4: close

 /**
  * Close
  *
  * Releases locks and closes connection.
  *
  * @return	bool
  */
 public function close()
 {
     if (isset($this->redis)) {
         try {
             if ($this->redis->ping() === '+PONG') {
                 isset($this->lockKey) && $this->redis->delete($this->lockKey);
                 if (!$this->redis->close()) {
                     return FALSE;
                 }
             }
         } catch (\RedisException $e) {
             $this->logger->error('Session: Got RedisException on close(): ' . $e->getMessage());
         }
         $this->redis = NULL;
         return TRUE;
     }
     return TRUE;
 }
开发者ID:titounnes,项目名称:CodeIgniter4,代码行数:25,代码来源:RedisHandler.php

示例5: __call


//.........这里部分代码省略.........
                 $args = array($args[0], array_merge($cKeys, $cArgs), count($cKeys));
                 break;
             case 'subscribe':
             case 'psubscribe':
                 break;
             case 'scan':
             case 'sscan':
             case 'hscan':
             case 'zscan':
                 // allow phpredis to see the caller's reference
                 //$param_ref =& $args[0];
                 break;
             default:
                 // Flatten arguments
                 $args = self::_flattenArguments($args);
         }
         try {
             // Proxy pipeline mode to the phpredis library
             if ($name == 'pipeline' || $name == 'multi') {
                 if ($this->isMulti) {
                     return $this;
                 } else {
                     $this->isMulti = TRUE;
                     $this->redisMulti = call_user_func_array(array($this->redis, $name), $args);
                 }
             } else {
                 if ($name == 'exec' || $name == 'discard') {
                     $this->isMulti = FALSE;
                     $response = $this->redisMulti->{$name}();
                     $this->redisMulti = NULL;
                     #echo "> $name : ".substr(print_r($response, TRUE),0,100)."\n";
                     return $response;
                 }
             }
             // Use aliases to be compatible with phpredis wrapper
             if (isset($this->wrapperMethods[$name])) {
                 $name = $this->wrapperMethods[$name];
             }
             // Multi and pipeline return self for chaining
             if ($this->isMulti) {
                 call_user_func_array(array($this->redisMulti, $name), $args);
                 return $this;
             }
             // Send request, retry one time when using persistent connections on the first request only
             $this->requests++;
             try {
                 $response = call_user_func_array(array($this->redis, $name), $args);
             } catch (RedisException $e) {
                 if ($this->persistent && $this->requests == 1 && $e->getMessage() == 'read error on connection') {
                     $this->connected = FALSE;
                     $this->connect();
                     $response = call_user_func_array(array($this->redis, $name), $args);
                 } else {
                     throw $e;
                 }
             }
         } catch (RedisException $e) {
             $code = 0;
             if (!($result = $this->redis->ping())) {
                 $this->connected = FALSE;
                 $code = CredisException::CODE_DISCONNECTED;
             }
             throw new CredisException($e->getMessage(), $code, $e);
         }
         #echo "> $name : ".substr(print_r($response, TRUE),0,100)."\n";
         // change return values where it is too difficult to minim in standalone mode
         switch ($name) {
             case 'hmget':
                 $response = array_values($response);
                 break;
             case 'type':
                 $typeMap = array(self::TYPE_NONE, self::TYPE_STRING, self::TYPE_SET, self::TYPE_LIST, self::TYPE_ZSET, self::TYPE_HASH);
                 $response = $typeMap[$response];
                 break;
                 // Handle scripting errors
             // Handle scripting errors
             case 'eval':
             case 'evalsha':
             case 'script':
                 $error = $this->redis->getLastError();
                 $this->redis->clearLastError();
                 if ($error && substr($error, 0, 8) == 'NOSCRIPT') {
                     $response = NULL;
                 } else {
                     if ($error) {
                         throw new CredisException($error);
                     }
                 }
                 break;
             default:
                 $error = $this->redis->getLastError();
                 $this->redis->clearLastError();
                 if ($error) {
                     throw new CredisException($error);
                 }
                 break;
         }
     }
     return $response;
 }
开发者ID:KarlDeux,项目名称:credis,代码行数:101,代码来源:Client.php


注:本文中的resource::ping方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。