@@ -61,19 +61,10 @@ be replaced by ``rediss`` (the second ``s`` means "secure").
61
61
62
62
.. note ::
63
63
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 .
65
65
66
66
.. code-block :: text
67
-
68
- redis[s]://[ip|host|socket[:port]][/db-index]
69
-
70
- .. code-block :: text
71
-
72
- redis[s]:[ip|host|socket[:port]][¶ms]
73
-
74
- Values for placeholders ``[:port] ``, ``[/db-index] `` and ``[¶ms] `` are optional.
75
- When using Symfony 5.x, you can't define a user or password for the connection
76
- DSN. That feature was added in the following Symfony versions.
67
+ redis[s]://[pass@][ip|host|socket[:port]][/db-index]
77
68
78
69
Below are common examples of valid DSNs showing a combination of available values::
79
70
@@ -91,11 +82,8 @@ Below are common examples of valid DSNs showing a combination of available value
91
82
// socket "/var/run/redis.sock" and auth "bad-pass"
92
83
RedisAdapter::createConnection('redis://bad-pass@/var/run/redis.sock');
93
84
94
- // host "redis1" (docker container) with alternate DSN syntax and selecting database index "3"
95
- RedisAdapter::createConnection('redis:?host[redis1:6379]&dbindex=3');
96
-
97
- // providing credentials with alternate DSN syntax
98
- RedisAdapter::createConnection('redis:default:verysecurepassword@?host[redis1:6379]&dbindex=3');
85
+ // a single DSN can define multiple servers using the following syntax:
86
+ // host[hostname-or-IP:port] (where port is optional). Sockets must include a trailing ':'
99
87
100
88
// a single DSN can also define multiple servers
101
89
RedisAdapter::createConnection(
@@ -110,16 +98,6 @@ parameter to set the name of your service group::
110
98
'redis:?host[redis1:26379]&host[redis2:26379]&host[redis3:26379]&redis_sentinel=mymaster'
111
99
);
112
100
113
- // providing credentials
114
- RedisAdapter::createConnection(
115
- 'redis:default:verysecurepassword@?host[redis1:26379]&host[redis2:26379]&host[redis3:26379]&redis_sentinel=mymaster'
116
- );
117
-
118
- // providing credentials and selecting database index "3"
119
- RedisAdapter::createConnection(
120
- 'redis:default:verysecurepassword@?host[redis1:26379]&host[redis2:26379]&host[redis3:26379]&redis_sentinel=mymaster&dbindex=3'
121
- );
122
-
123
101
.. note ::
124
102
125
103
See the :class: `Symfony\\ Component\\ Cache\\ Traits\\ RedisTrait ` for more options
0 commit comments