@@ -176,7 +176,7 @@ public static function createConnection($dsn, array $options = [])
176
176
177
177
$ initializer = static function ($ redis ) use ($ connect , $ params , $ dsn , $ auth , $ hosts ) {
178
178
try {
179
- @$ redis ->{$ connect }($ hosts [0 ]['host ' ] ?? $ hosts [0 ]['path ' ], $ hosts [0 ]['port ' ] ?? null , $ params ['timeout ' ], (string ) $ params ['persistent_id ' ], $ params ['retry_interval ' ]);
179
+ @$ redis ->{$ connect }($ hosts [0 ]['host ' ] ?? $ hosts [0 ]['path ' ], $ hosts [0 ]['port ' ] ?? null , $ params ['timeout ' ], (string ) $ params ['persistent_id ' ], $ params ['retry_interval ' ], $ params [ ' read_timeout ' ] );
180
180
181
181
set_error_handler (function ($ type , $ msg ) use (&$ error ) { $ error = $ msg ; });
182
182
$ isConnected = $ redis ->isConnected ();
@@ -188,7 +188,6 @@ public static function createConnection($dsn, array $options = [])
188
188
189
189
if ((null !== $ auth && !$ redis ->auth ($ auth ))
190
190
|| ($ params ['dbindex ' ] && !$ redis ->select ($ params ['dbindex ' ]))
191
- || ($ params ['read_timeout ' ] && !$ redis ->setOption (\Redis::OPT_READ_TIMEOUT , $ params ['read_timeout ' ]))
192
191
) {
193
192
$ e = preg_replace ('/^ERR / ' , '' , $ redis ->getLastError ());
194
193
throw new InvalidArgumentException (sprint
6620
f ('Redis connection "%s" failed: ' , $ dsn ).$ e .'. ' );
@@ -215,6 +214,7 @@ public static function createConnection($dsn, array $options = [])
215
214
}
216
215
$ params ['lazy_connect ' ] = $ params ['lazy ' ] ?? true ;
217
216
$ params ['connect_timeout ' ] = $ params ['timeout ' ];
217
+ $ params ['read_timeout ' ] = $ params ['read_timeout ' ];
218
218
219
219
try {
220
220
$ redis = new $ class ($ hosts , $ params );
0 commit comments