12
12
namespace Symfony \Component \Cache \Traits ;
13
13
14
14
use Predis \Connection \Factory ;
15
+ use Predis \Connection \Aggregate \ClusterInterface ;
15
16
use Predis \Connection \Aggregate \PredisCluster ;
16
17
use Predis \Connection \Aggregate \RedisCluster ;
17
18
use Predis \Response \Status ;
@@ -284,7 +285,7 @@ private function pipeline(\Closure $generator)
284
285
{
285
286
$ ids = array ();
286
287
287
- if ($ this ->redis instanceof \Predis \Client) {
288
+ if ($ this ->redis instanceof \Predis \Client && ! $ this -> redis -> getConnection () instanceof ClusterInterface ) {
288
289
$ results = $ this ->redis ->pipeline (function ($ redis ) use ($ generator , &$ ids ) {
289
290
foreach ($ generator () as $ command => $ args ) {
290
291
call_user_func_array (array ($ redis , $ command ), $ args );
@@ -308,9 +309,10 @@ private function pipeline(\Closure $generator)
308
309
foreach ($ results as $ k => list ($ h , $ c )) {
309
310
$ results [$ k ] = $ connections [$ h ][$ c ];
310
311
}
311
- } elseif ($ this ->redis instanceof \RedisCluster) {
312
- // phpredis doesn 't support pipelining with RedisCluster
312
+ } elseif ($ this ->redis instanceof \RedisCluster || ( $ this -> redis instanceof \ Predis \Client && $ this -> redis -> getConnection () instanceof ClusterInterface) ) {
313
+ // phpredis & predis don 't support pipelining with RedisCluster
313
314
// see https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#pipelining
315
+ // see https://github.com/nrk/predis/issues/267#issuecomment-123781423
314
316
$ results = array ();
315
317
foreach ($ generator () as $ command => $ args ) {
316
318
$ results [] = call_user_func_array (array ($ this ->redis , $ command ), $ args );
0 commit comments