@@ -291,8 +291,10 @@ public static function createConnection(string $dsn, array $options = [])
291
291
} elseif (is_a ($ class , \RedisArray::class, true )) {
292
292
foreach ($ hosts as $ i => $ host ) {
293
293
switch ($ host ['scheme ' ]) {
294
- case 'tcp ' : $ hosts [$ i ] = $ host ['host ' ].': ' .$ host ['port ' ]; break ;
295
- case 'tls ' : $ hosts [$ i ] = 'tls:// ' .$ host ['host ' ].': ' .$ host ['port ' ]; break ;
294
+ case 'tcp ' : $ hosts [$ i ] = $ host ['host ' ].': ' .$ host ['port ' ];
295
+ break ;
296
+ case 'tls ' : $ hosts [$ i ] = 'tls:// ' .$ host ['host ' ].': ' .$ host ['port ' ];
297
+ break ;
296
298
default : $ hosts [$ i ] = $ host ['path ' ];
297
299
}
298
300
}
@@ -312,8 +314,10 @@ public static function createConnection(string $dsn, array $options = [])
312
314
$ initializer = static function () use ($ class , $ params , $ dsn , $ hosts ) {
313
315
foreach ($ hosts as $ i => $ host ) {
314
316
switch ($ host ['scheme ' ]) {
315
- case 'tcp ' : $ hosts [$ i ] = $ host ['host ' ].': ' .$ host ['port ' ]; break ;
316
- case 'tls ' : $ hosts [$ i ] = 'tls:// ' .$ host ['host ' ].': ' .$ host ['port ' ]; break ;
317
+ case 'tcp ' : $ hosts [$ i ] = $ host ['host ' ].': ' .$ host ['port ' ];
318
+ break ;
319
+ case 'tls ' : $ hosts [$ i ] = 'tls:// ' .$ host ['host ' ].': ' .$ host ['port ' ];
320
+ break ;
317
321
default : $ hosts [$ i ] = $ host ['path ' ];
318
322
}
319
323
}
@@ -328,9 +332,12 @@ public static function createConnection(string $dsn, array $options = [])
328
332
$ redis ->setOption (\Redis::OPT_TCP_KEEPALIVE , $ params ['tcp_keepalive ' ]);
329
333
}
330
334
switch ($ params ['failover ' ]) {
331
- case 'error ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_ERROR ); break ;
332
- case 'distribute ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_DISTRIBUTE ); break ;
333
- case 'slaves ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_DISTRIBUTE_SLAVES ); break ;
335
+ case 'error ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_ERROR );
336
+ break ;
337
+ case 'distribute ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_DISTRIBUTE );
338
+ break ;
339
+ case 'slaves ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_DISTRIBUTE_SLAVES );
340
+ break ;
334
341
}
335
342
336
343
return $ redis ;
@@ -476,7 +483,7 @@ protected function doClear(string $namespace)
476
483
477
484
$ cursor = null ;
478
485
do {
479
- $ keys = $ host instanceof \Predis \ClientInterface ? $ host ->scan ($ cursor , 'MATCH ' , $ pattern , 'COUNT ' , 1000 ) : $ host ->scan ($ cursor , $ pattern , 1000 );
486
+ $ keys = $ host instanceof \Predis \ClientInterface ? $ host ->scan ($ cursor , 'MATCH ' , $ pattern , 'COUNT ' , 1000 ) : $ host ->scan ($ cursor , $ pattern , 1000 , ' string ' );
480
487
if (isset ($ keys [1 ]) && \is_array ($ keys [1 ])) {
481
488
$ cursor = $ keys [0 ];
482
489
$ keys = $ keys [1 ];
0 commit comments