mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Merge pull request #3659 from dogmatic69/patch-3
simplify connect code for redis
This commit is contained in:
commit
9e744113f0
1 changed files with 6 additions and 7 deletions
|
@ -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']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue