1212namespace Symfony \Component \Cache \Traits ;
1313
1414use Predis \Connection \Factory ;
15+ use Predis \Connection \Aggregate \ClusterInterface ;
1516use Predis \Connection \Aggregate \PredisCluster ;
1617use Predis \Connection \Aggregate \RedisCluster ;
1718use Predis \Response \Status ;
@@ -284,7 +285,7 @@ private function pipeline(\Closure $generator)
284285 {
285286$ ids =array ();
286287
287- if ($ this ->redis instanceof \Predis \Client) {
288+ if ($ this ->redis instanceof \Predis \Client && ! $ this -> redis -> getConnection () instanceof ClusterInterface ) {
288289$ results =$ this ->redis ->pipeline (function ($ redis )use ($ generator , &$ ids ) {
289290foreach ($ generator ()as $ command =>$ args ) {
290291call_user_func_array (array ($ redis ,$ command ),$ args );
@@ -308,9 +309,10 @@ private function pipeline(\Closure $generator)
308309foreach ($ resultsas $ k =>list ($ h ,$ c )) {
309310$ results [$ k ] =$ connections [$ h ][$ c ];
310311 }
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 doesn't support pipelining with RedisCluster
313314// see https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#pipelining
315+ // see https://github.com/nrk/predis/issues/267#issuecomment-123781423
314316$ results =array ();
315317foreach ($ generator ()as $ command =>$ args ) {
316318$ results [] =call_user_func_array (array ($ this ->redis ,$ command ),$ args );