开发者

Does each call within a multi() call in phpredis result in a new network roundtrip to redis?

开发者 https://www.devze.com 2023-02-16 21:03 出处:网络
Within phpredis (the c client for redis in php), there is a \'pipeline\' call and a \'multi\' call. From the docs, the \'pipeline\' call clearly states that all queries within the pipeline will be que

Within phpredis (the c client for redis in php), there is a 'pipeline' call and a 'multi' call. From the docs, the 'pipeline' call clearly states that all queries within the pipeline will be queued and sent all at once to redis. However, it is not clear from the docs if all queries within a multi() call in phpredis are also queued and sent all at once to redis, or if each call within multi() will result in a separate roundtrip over the network to the redis server.

So, the question is, does each call within a multi() call (as opposed to a pipeline call开发者_JS百科) in phpredis result in a new network roundtrip to redis?


Unfortunately there is no way at the moment to pipeline calls in a multi/exec block, so it's either pipelined or atomic.

Each call between multi() and exec() is sent individually.


The phpredis function "multi()" uses only one network roundtrip. You can specify whether you want the whole transaction to be atomic or not by using Redis::MULTI for atomic and Redis::PIPELINE for non-atomic (composite?). If you don't specify, it defaults to Reis::MULTI. It's all in the docs here.

0

精彩评论

暂无评论...
验证码 换一张
取 消