Exemple #1
0
 /**
  * 检查驱动是否可用
  * @return boolean      是否可用
  */
 public function checkDriver()
 {
     if (!$this->isConnected && $this->reConnected < $this->maxReConnected) {
         try {
             if ($this->handler->ping() == '+PONG') {
                 $this->isConnected = true;
             }
         } catch (RedisException $ex) {
             self::exception($ex);
             $this->connect();
         }
         if (!$this->isConnected) {
             $this->reConnected++;
         } else {
             $this->reConnected = 0;
         }
     }
     return $this->isConnected;
 }