1

My application uses a singleton connection of redis everywhere, it's initialized at the startup. My understanding of MULTI.EXEC() tells that all my WATCHed keys would be UNWATCHed when the MULTI.EXEC() is called anywhere in the application. This would mean that all keys WATCHed irrespective of which MULTI block they were WATCHed for will be unwatched, beating the whole purpose of WATCHing them.

  1. Is my understanding correct?
  2. How do I avoid this situation, should I create a new connection for each transaction?

1 Answers1

0

This process happened inside Redis Server and will block all incoming command. So it doesn't matter if you use single or multiple connections(all connections will be blocked)

Gawain
  • 1,017
  • 8
  • 17
  • https://stackoverflow.com/questions/26607397/interleaving-watch-multi-exec-on-a-single-redis-connection-expected-or-weird-be Suggests otherwise. Can you please confirm this? – Shubham Sharma Aug 13 '21 at 11:12