Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

Transaction#select() replacement since Jedis version 4

$
0
0

We are in the process of upgrading the Jedis dependency for one of our services from version 3.7.0 to the latest version 5.0.0.

In the process, we encountered an event that prevents us from using the previous code.

> ```>// watch for key in database 0>jedis.watch(key);>jedis.select(1);>// watch for key2 in database 1>jedis.watch(key2);>jedis.select(0);> >Transaction transaction = jedis.multi();> >transaction.hset(key, "name", "john Doe");>transaction.hset(key, "class", "Worker");> >// method cannot be used.>transaction.select(1);> >transaction.hset(key2, "name", "jane Doe");>transaction.hset(key2, "class", "Worker");>transaction.exec();> ```

As you can see, we used method call, but since version 4 - it is removed. What would be the closest equivalent (or is it needed at all) of the call since Jedis version 4?transaction.select(int index)

I consider the following method as an alternative.
transaction.sendCommand(SELECT, toByteArray(9));
However, I could not determine if using this method is the best answer.
I think there is some glitch or inconvenient reason why that method was removed.

I would like to minimize the impact of code changes in the recommended manner.
I would also like to know why it was removed.transaction.select(int index)


Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>