Skip to content

Commit 88540e6

Browse files
committed
[Cache] Mention that user/password are not supported for Redis DSN
1 parent 14c83db commit 88540e6

File tree

1 file changed

+6
-25
lines changed

1 file changed

+6
-25
lines changed

components/cache/adapters/redis_adapter.rst

+6-25
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,18 @@ helper method allows creating and configuring the Redis client class instance us
5555
'redis://localhost'
5656
);
5757

58-
The DSN can specify either an IP/host (and an optional port) or a socket path, as well as a
59-
password and a database index. To enable TLS for connections, the scheme ``redis`` must be
60-
replaced by ``rediss`` (the second ``s`` means "secure").
58+
The DSN can specify either an IP/host (and an optional port) or a socket path, as
59+
well as a database index. To enable TLS for connections, the scheme ``redis`` must
60+
be replaced by ``rediss`` (the second ``s`` means "secure").
6161

6262
.. note::
6363

64-
A `Data Source Name (DSN)`_ for this adapter must use either one of the following formats.
64+
A `Data Source Name (DSN)`_ for this adapter must use the following format.
6565

6666
.. code-block:: text
6767
6868
redis[s]://[pass@][ip|host|socket[:port]][/db-index]
6969
70-
.. code-block:: text
71-
72-
redis[s]:[[user]:pass@]?[ip|host|socket[:port]][&params]
73-
74-
Values for placeholders ``[user]``, ``[:port]``, ``[/db-index]`` and ``[&params]`` are optional.
75-
7670
Below are common examples of valid DSNs showing a combination of available values::
7771

7872
use Symfony\Component\Cache\Adapter\RedisAdapter;
@@ -89,11 +83,8 @@ Below are common examples of valid DSNs showing a combination of available value
8983
// socket "/var/run/redis.sock" and auth "bad-pass"
9084
RedisAdapter::createConnection('redis://bad-pass@/var/run/redis.sock');
9185

92-
// host "redis1" (docker container) with alternate DSN syntax and selecting database index "3"
93-
RedisAdapter::createConnection('redis:?host[redis1:6379]&dbindex=3');
94-
95-
// providing credentials with alternate DSN syntax
96-
RedisAdapter::createConnection('redis:default:verysecurepassword@?host[redis1:6379]&dbindex=3');
86+
// a single DSN can define multiple servers using the following syntax:
87+
// host[hostname-or-IP:port] (where port is optional). Sockets must include a trailing ':'
9788

9889
// a single DSN can also define multiple servers
9990
RedisAdapter::createConnection(
@@ -108,16 +99,6 @@ parameter to set the name of your service group::
10899
'redis:?host[redis1:26379]&host[redis2:26379]&host[redis3:26379]&redis_sentinel=mymaster'
109100
);
110101

111-
// providing credentials
112-
RedisAdapter::createConnection(
113-
'redis:default:verysecurepassword@?host[redis1:26379]&host[redis2:26379]&host[redis3:26379]&redis_sentinel=mymaster'
114-
);
115-
116-
// providing credentials and selecting database index "3"
117-
RedisAdapter::createConnection(
118-
'redis:default:verysecurepassword@?host[redis1:26379]&host[redis2:26379]&host[redis3:26379]&redis_sentinel=mymaster&dbindex=3'
119-
);
120-
121102
.. note::
122103

123104
See the :class:`Symfony\\Component\\Cache\\Traits\\RedisTrait` for more options

0 commit comments

Comments
 (0)