I'm using jedis, and wish to get the result of a key and modify it and then store it back,
String dataToModify = jedis.get(parent_id);
//some modify eg:
modifiedData = dataToModify + "modify";
jedis.set(parent_id, modifiedData);
but I then realized that if someone else modified data in key parent_id
, between this get
and set
, there will be collision. the watch-multi-exec
does not work since I need to get the value of key parent_id
during the transaction. Is there any other way to do this atomically? thanks