@@ -59,24 +59,18 @@ helper method allows creating and configuring the Redis client class instance us
59
59
'redis://localhost'
60
60
);
61
61
62
- The DSN can specify either an IP/host (and an optional port) or a socket path, as well as a
63
- password and a database index. To enable TLS for connections, the scheme ``redis `` must be
64
- replaced by ``rediss `` (the second ``s `` means "secure").
62
+ The DSN can specify either an IP/host (and an optional port) or a socket path, as
63
+ well as a database index. To enable TLS for connections, the scheme ``redis `` must
64
+ be replaced by ``rediss `` (the second ``s `` means "secure").
65
65
66
66
.. note ::
67
67
68
- A `Data Source Name (DSN) `_ for this adapter must use either one of the following formats .
68
+ A `Data Source Name (DSN) `_ for this adapter must use the following format .
69
69
70
70
.. code-block :: text
71
71
72
72
redis[s]://[pass@][ip|host|socket[:port]][/db-index]
73
73
74
- .. code-block :: text
75
-
76
- redis[s]:[[user]:pass@]?[ip|host|socket[:port]][¶ms]
77
-
78
- Values for placeholders ``[user] ``, ``[:port] ``, ``[/db-index] `` and ``[¶ms] `` are optional.
79
-
80
74
Below are common examples of valid DSNs showing a combination of available values::
81
75
82
76
use Symfony\Component\Cache\Adapter\RedisAdapter;
@@ -93,11 +87,8 @@ Below are common examples of valid DSNs showing a combination of available value
93
87
// socket "/var/run/redis.sock" and auth "bad-pass"
94
88
RedisAdapter::createConnection('redis://bad-pass@/var/run/redis.sock');
95
89
96
- // host "redis1" (docker container) with alternate DSN syntax and selecting database index "3"
97
- RedisAdapter::createConnection('redis:?host[redis1:6379]&dbindex=3');
98
-
99
- // providing credentials with alternate DSN syntax
100
- RedisAdapter::createConnection('redis:default:verysecurepassword@?host[redis1:6379]&dbindex=3');
90
+ // a single DSN can define multiple servers using the following syntax:
91
+ // host[hostname-or-IP:port] (where port is optional). Sockets must include a trailing ':'
101
92
102
93
// a single DSN can also define multiple servers
103
94
RedisAdapter::createConnection(
@@ -112,16 +103,6 @@ parameter to set the name of your service group::
112
103
'redis:?host[redis1:26379]&host[redis2:26379]&host[redis3:26379]&redis_sentinel=mymaster'
113
104
);
114
105
115
- // providing credentials
116
- RedisAdapter::createConnection(
117
- 'redis:default:verysecurepassword@?host[redis1:26379]&host[redis2:26379]&host[redis3:26379]&redis_sentinel=mymaster'
118
- );
119
-
120
- // providing credentials and selecting database index "3"
121
- RedisAdapter::createConnection(
122
- 'redis:default:verysecurepassword@?host[redis1:26379]&host[redis2:26379]&host[redis3:26379]&redis_sentinel=mymaster&dbindex=3'
123
- );
124
-
125
106
.. note ::
126
107
127
108
See the :class: `Symfony\\ Component\\ Cache\\ Traits\\ RedisTrait ` for more options
0 commit comments