protected function tearDown() { if ($this->credis) { $this->credis->close(); $this->credis = NULL; } }
/** * 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; }
/** * 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'); } }
/** * 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; }
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'); }
/** * 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; }
/** * Overridden to prevent calling getLifeTime at shutdown * * @return bool */ public function close() { $this->_log("Closing connection"); if ($this->_redis) { $this->_redis->close(); } return true; }