Is redis transaction (WATCH, MULTI ,EXEC ) possible over multiplexed connection?

Viewed 79

I am using Redis library that offers Connection multiplexing (I am currently using the Rust lib , but I think the question is relevant for any implementation).

According to the what I've read about multiplexing (And also what I understand from the lib implementation) , It utilizes the same connection for handling db operations from multiple contexts (threads/tasks/etc..).

Now, I'm not sure what will happened if WATCH is called in parallel with 2 different contexts on the same multiplexed-connection. Will the EXEC from one context cancel the WATCH in the other thread, or maybe Redis somehow knows how to distinguish between contexts even though they're utilizing the same connection?

1 Answers

No, it's not possible over multiplexed connection. The Redis transaction context is attached to a specific "client" meaning a specific conneciton.

Related