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:
Daniele Alessandri
2016-05-13 12:48:31 +02:00
parent 104e42cfe0
commit a816adf6e7
3 changed files with 37 additions and 3 deletions
@@ -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;
}
}