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

Spring Data Redis resolving race conditions

$
0
0

Currently I am trying to develop an application using Spring Data Redis but I’m looking for a solution to the current race condition I am facing.

The general idea for the application is:

  1. Retrieve a key from redis where the value is null (redis will be prepopulated with many keys which are null)
  2. Update the value to something.

However I with multiple nodes of the application running concurrently, I envision that there could be a race condition where 2 nodes both retrieve the same key and both update the value meaning one node will overwrite the value set by the other node. Instead I would like both nodes to retrieve different keys to update.

I was wondering what would be the best way to avoid this race condition on Spring Data Redis.


Viewing all articles
Browse latest Browse all 2204

Trending Articles



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