Merge pull request #3659 from dogmatic69/patch-3

simplify connect code for redis
This commit is contained in:
Mark Story 2014-06-06 10:08:36 -04:00
commit 9e744113f0

View file

@ -79,7 +79,6 @@ class RedisEngine extends CacheEngine {
* @return boolean True if Redis server was connected
*/
protected function _connect() {
$return = false;
try {
$this->_Redis = new Redis();
if (!empty($this->settings['unix_socket'])) {
@ -91,15 +90,15 @@ class RedisEngine extends CacheEngine {
$return = $this->_Redis->pconnect($this->settings['server'], $this->settings['port'], $this->settings['timeout'], $persistentId);
}
} catch (RedisException $e) {
$return = false;
}
if (!$return) {
return false;
}
if ($return && $this->settings['password']) {
$return = $this->_Redis->auth($this->settings['password']);
if ($this->settings['password'] && !$this->_Redis->auth($this->settings['password'])) {
return false;
}
if ($return) {
$return = $this->_Redis->select($this->settings['database']);
}
return $return;
return $this->_Redis->select($this->settings['database']);
}
/**