File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ class Redis implements Adapter
28
28
'read_timeout ' => '10 ' ,
29
29
'persistent_connections ' => false ,
30
30
'password ' => null ,
31
+ 'user ' => null ,
31
32
];
32
33
33
34
/**
@@ -195,9 +196,18 @@ private function ensureOpenConnection(): void
195
196
}
196
197
197
198
$ this ->connectToServer ();
199
+ $ authParams = [];
198
200
199
- if ($ this ->options ['password ' ] !== null ) {
200
- $ this ->redis ->auth ($ this ->options ['password ' ]);
201
+ if (isset ($ this ->options ['user ' ])) {
202
+ $ authParams [] = $ this ->options ['user ' ];
203
+ }
204
+
205
+ if (isset ($ this ->options ['password ' ])) {
206
+ $ authParams [] = $ this ->options ['password ' ];
207
+ }
208
+
209
+ if ($ authParams !== []) {
210
+ $ this ->redis ->auth ($ authParams );
201
211
}
202
212
203
213
if (isset ($ this ->options ['database ' ])) {
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ class RedisNg implements Adapter
28
28
'read_timeout ' => '10 ' ,
29
29
'persistent_connections ' => false ,
30
30
'password ' => null ,
31
+ 'user ' => null ,
31
32
];
32
33
33
34
/**
@@ -195,9 +196,18 @@ private function ensureOpenConnection(): void
195
196
}
196
197
197
198
$ this ->connectToServer ();
199
+ $ authParams = [];
198
200
199
- if ($ this ->options ['password ' ] !== null ) {
200
- $ this ->redis ->auth ($ this ->options ['password ' ]);
201
+ if (isset ($ this ->options ['user ' ])) {
202
+ $ authParams [] = $ this ->options ['user ' ];
203
+ }
204
+
205
+ if (isset ($ this ->options ['password ' ])) {
206
+ $ authParams [] = $ this ->options ['password ' ];
207
+ }
208
+
209
+ if ($ authParams !== []) {
210
+ $ this ->redis ->auth ($ authParams );
201
211
}
202
212
203
213
if (isset ($ this ->options ['database ' ])) {
You can’t perform that action at this time.
0 commit comments