@@ -55,24 +55,18 @@ helper method allows creating and configuring the Redis client class instance us
55
55
'redis://localhost'
56
56
);
57
57
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").
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
67
68
68
redis[s]://[pass@][ip|host|socket[:port]][/db-index]
69
69
70
- .. code-block :: text
71
-
72
- redis[s]:[[user]:pass@]?[ip|host|socket[:port]][¶ms]
73
-
74
- Values for placeholders ``[user] ``, ``[:port] ``, ``[/db-index] `` and ``[¶ms] `` are optional.
75
-
76
70
Below are common examples of valid DSNs showing a combination of available values::
77
71
78
72
use Symfony\Component\Cache\Adapter\RedisAdapter;
@@ -89,11 +83,8 @@ Below are common examples of valid DSNs showing a combination of available value
89
83
// socket "/var/run/redis.sock" and auth "bad-pass"
90
84
RedisAdapter::createConnection('redis://bad-pass@/var/run/redis.sock');
91
85
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 ':'
97
88
98
89
// a single DSN can also define multiple servers
99
90
RedisAdapter::createConnection(
@@ -108,16 +99,6 @@ parameter to set the name of your service group::
108
99
'redis:?host[redis1:26379]&host[redis2:26379]&host[redis3:26379]&redis_sentinel=mymaster'
109
100
);
110
101
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
-
121
102
.. note ::
122
103
123
104
See the :class: `Symfony\\ Component\\ Cache\\ Traits\\ RedisTrait ` for more options
0 commit comments