mirror of
https://github.com/predis/predis.git
synced 2026-11-03 09:35:11 +00:00
Set default parameters via client options.
This is mostly useful when configuring the client to use redis-cluster or redis-sentinel in order to set a common password for authentication or database. In these kind of configurations it is impossible to pass them via connection parameters as connections are created dinamically by the client depending on the server response.
This commit is contained in:
@@ -49,6 +49,12 @@ class ConnectionFactoryOption implements OptionInterface
|
||||
*/
|
||||
public function getDefault(OptionsInterface $options)
|
||||
{
|
||||
return new Factory();
|
||||
$factory = new Factory();
|
||||
|
||||
if ($options->defined('parameters')) {
|
||||
$factory->setDefaultParameters($options->parameters);
|
||||
}
|
||||
|
||||
return $factory;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user