mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +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
|
* @return boolean True if Redis server was connected
|
||||||
*/
|
*/
|
||||||
protected function _connect() {
|
protected function _connect() {
|
||||||
$return = false;
|
|
||||||
try {
|
try {
|
||||||
$this->_Redis = new Redis();
|
$this->_Redis = new Redis();
|
||||||
if (!empty($this->settings['unix_socket'])) {
|
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);
|
$return = $this->_Redis->pconnect($this->settings['server'], $this->settings['port'], $this->settings['timeout'], $persistentId);
|
||||||
}
|
}
|
||||||
} catch (RedisException $e) {
|
} catch (RedisException $e) {
|
||||||
|
$return = false;
|
||||||
|
}
|
||||||
|
if (!$return) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($return && $this->settings['password']) {
|
if ($this->settings['password'] && !$this->_Redis->auth($this->settings['password'])) {
|
||||||
$return = $this->_Redis->auth($this->settings['password']);
|
return false;
|
||||||
}
|
}
|
||||||
if ($return) {
|
return $this->_Redis->select($this->settings['database']);
|
||||||
$return = $this->_Redis->select($this->settings['database']);
|
|
||||||
}
|
|
||||||
return $return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue