Why doesn't the multi of Redis send a package of commands to the redis server as pipeline does, instead of sending a package with one command?

Why does the multi of Redis not package the command to the redis server as pipeline does, but instead send a package with one command?

Mar.29,2022

by default, the multi command of redis sends commands to the redis server one by one in the form of Redis::MULTI , which has the advantage of ensuring that a series of commands sent to redis are executed atomically. However, the shortcomings are also quite obvious, and the efficiency is relatively low.
so, as asked by the subject, multi of redis also provides pipeline way to send, as long as you set the Redis::PIPELINE mode

$multi = $redis->multi(Redis::PIPELINE);

atomicity is not guaranteed with pipeline, so choose which method to use for the business scenario.

Menu