mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
RedisEngine: authenticate connection if 'password' is set
This commit is contained in:
parent
0196c6f686
commit
7d844866f0
3 changed files with 7 additions and 2 deletions
|
@ -103,7 +103,7 @@ class Cache {
|
|||
* - `path` Used by FileCache. Path to where cachefiles should be saved.
|
||||
* - `lock` Used by FileCache. Should files be locked before writing to them?
|
||||
* - `user` Used by Xcache. Username for XCache
|
||||
* - `password` Used by Xcache. Password for XCache
|
||||
* - `password` Used by Xcache/Redis. Password for XCache/Redis
|
||||
*
|
||||
* @see app/Config/core.php for configuration settings
|
||||
* @param string $name Name of the configuration
|
||||
|
|
|
@ -62,6 +62,7 @@ class RedisEngine extends CacheEngine {
|
|||
'prefix' => null,
|
||||
'server' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'password' => false,
|
||||
'timeout' => 0,
|
||||
'persistent' => true
|
||||
), $settings)
|
||||
|
@ -87,6 +88,9 @@ class RedisEngine extends CacheEngine {
|
|||
} catch (RedisException $e) {
|
||||
return false;
|
||||
}
|
||||
if ($return && $this->settings['password']) {
|
||||
$return = $this->_Redis->auth($this->settings['password']);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,8 @@ class RegisEngineTest extends CakeTestCase {
|
|||
'server' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'timeout' => 0,
|
||||
'persistent' => true
|
||||
'persistent' => true,
|
||||
'password' => false,
|
||||
);
|
||||
$this->assertEquals($expecting, $settings);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue