@@ -53,16 +53,16 @@ helper method allows creating and configuring the Redis client class instance us
5353 'redis://localhost'
5454 );
5555
56- The DSN can specify either an IP/host (and an optional port) or a socket path, as well as a user
57- and password and a database index.
56+ The DSN can specify either an IP/host (and an optional port) or a socket path, as well as a
57+ password and a database index.
5858
5959.. note ::
6060
6161 A `Data Source Name (DSN) `_ for this adapter must use the following format.
6262
6363 .. code-block :: text
6464
65- redis://[user: pass@][ip|host|socket[:port]][/db-index]
65+ redis://[pass@][ip|host|socket[:port]][/db-index]
6666
6767 Below are common examples of valid DSNs showing a combination of available values::
6868
@@ -74,11 +74,26 @@ Below are common examples of valid DSNs showing a combination of available value
7474 // host "my.server.com" and port "6379" and database index "20"
7575 RedisAdapter::createConnection('redis://my.server.com:6379/20');
7676
77- // host "localhost" and SASL use "rmf " and pass "abcdef"
78- RedisAdapter::createConnection('redis://rmf: abcdef@localhost');
77+ // host "localhost", auth "abcdef " and timeout 5 seconds
78+ RedisAdapter::createConnection('redis://abcdef@localhost?timeout=5 ');
7979
80- // socket "/var/run/redis.sock" and SASL user "user1" and pass "bad-pass"
81- RedisAdapter::createConnection('redis://user1:bad-pass@/var/run/redis.sock');
80+ // socket "/var/run/redis.sock" and auth "bad-pass"
81+ RedisAdapter::createConnection('redis://bad-pass@/var/run/redis.sock');
82+
83+ // a single DSN can define multiple servers using the following syntax:
84+ // host[hostname-or-IP:port] (where port is optional). Sockets must include a trailing ':'
85+ RedisAdapter::createConnection(
86+ 'redis:?host[localhost]&host[localhost:6379]&host[/var/run/redis.sock:]&auth=my-password&redis_cluster=1'
87+ );
88+
89+ .. versionadded :: 4.2
90+
91+ The option to define multiple servers in a single DSN was introduced in Symfony 4.2.
92+
93+ .. note ::
94+
95+ See the :class: `Symfony\\ Component\\ Cache\\ Traits\\ RedisTrait ` for more options
96+ you can pass as DSN parameters.
8297
8398Configure the Options
8499---------------------
0 commit comments