close() public method

public close ( ) : boolean
return boolean
Exemplo n.º 1
0
 protected function tearDown()
 {
     if ($this->credis) {
         $this->credis->close();
         $this->credis = NULL;
     }
 }
Exemplo n.º 2
0
 /**
  * Overridden to prevent calling getLifeTime at shutdown
  *
  * @return bool
  */
 public function close()
 {
     if (!$this->_useRedis) {
         return parent::close();
     }
     if ($this->_logLevel >= 7) {
         Mage::log(sprintf("%s: Closing connection", $this->_getPid()), Zend_Log::DEBUG, self::LOG_FILE);
     }
     if ($this->_redis) {
         $this->_redis->close();
     }
     return TRUE;
 }
Exemplo n.º 3
0
 /**
  * Log a hit or a miss to Redis.
  *
  * @param string $fullActionName
  * @param bool $hit
  */
 public function logRequest($fullActionName, $hit)
 {
     try {
         $redis = new Credis_Client($this->config->server, NULL, 0.1);
         $redis->pipeline();
         if ($this->config->db) {
             $redis->select($this->config->db);
         }
         $redis->incr('diehard:' . ($hit ? 'hit' : 'miss'));
         if ($fullActionName && $this->config->is('full_action_name')) {
             $redis->incr('diehard:' . $fullActionName . ':' . ($hit ? 'hit' : 'miss'));
         }
         $redis->exec();
         $redis->close();
     } catch (Exception $e) {
         Mage::log($e->getMessage(), Zend_Log::ERR, 'diehard_counter.log');
     }
 }
Exemplo n.º 4
0
 /**
  * Overridden to prevent calling getLifeTime at shutdown
  *
  * @return bool
  */
 public function close()
 {
     if ($this->_logLevel >= \Zend_Log::DEBUG) {
         $this->_log("Closing connection");
     }
     if ($this->_redis) {
         $this->_redis->close();
     }
     return TRUE;
 }
Exemplo n.º 5
0
 public function testInvalidUnixSocketConnectionstring()
 {
     $this->credis->close();
     $this->setExpectedException('CredisException', 'Invalid unix socket format; expected unix:///path/to/redis.sock');
     $this->credis = new Credis_Client('unix://path/to/redis.sock');
 }
Exemplo n.º 6
0
 /**
  * Overridden to prevent calling getLifeTime at shutdown
  *
  * @return bool
  */
 public function close()
 {
     if (!$this->_useRedis) {
         return parent::close();
     }
     if ($this->_logLevel >= Zend_Log::DEBUG) {
         $this->_log("Closing connection");
     }
     if ($this->_redis) {
         $this->_redis->close();
     }
     return TRUE;
 }
Exemplo n.º 7
0
 /**
  * Overridden to prevent calling getLifeTime at shutdown
  *
  * @return bool
  */
 public function close()
 {
     $this->_log("Closing connection");
     if ($this->_redis) {
         $this->_redis->close();
     }
     return true;
 }