Redis pipeline operation

If you need to send a lot of commands to the server in one operation, it is recommended that you use the pipeline command. The pipeline method receives a closure with a Redis instance. You can send all the commands to this Redis instance, and they will all be executed in one go:

For example, if you set 10 keys in succession, you can return an array. You can traverse to determine whether all are successful:

 public function testPipeline()
{
    $count  = 10;
    $result = Redis::pipeline(function (\Redis $redis) use ($count) {
        for ($i = 0; $i < $count; $i++) {
            $redis->set("key:$i", $i);
        }
    });

  // \count($result) ==  $count;

    foreach ($result as $index => $value) {
      //  $index 第几个
      //  $value == true 或者 $value == false
    }
} 
/docs/2.x/en/redis/pipeline.html
progress-bar