Abhi
Abhi

Reputation: 31

Redis - How to use async MULTI?

We are using hiredis from our C++ application using the redisAsyncCommandArgv interface. What we are not able to figure out is how to execute a bunch of commands in a MULTI-EXEC transaction. The redisAsyncCommandArgv encodes only one command at a time. Can it be used to send all the commands in a transaction in one go? Synchronous API is straight forward but, they cannot be used.

Any help?

Upvotes: 3

Views: 1326

Answers (1)

Axel Advento
Axel Advento

Reputation: 3065

It is impossible to use MULTI-EXEC over Redis Asynchronous API. You can only choose one.

MULTI-EXEC transactions SHOULD always execute sequentially. Redis Asynchronous API, on the other hand, allows the commands to be delivered out of order. Hence, it won't make sense to make a MULTI-EXEC transaction if the commands aren't in the proper sequence or worse, if MULTI and EXEC commands themselves became out of order.

Upvotes: 1

Related Questions