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

How to use lock/unlock in Redisson?

$
0
0

In our application we use AWS Redis cluster for storing an object which has multiple line items object embedded. We receive updates on individual line items so we fetch it from cache and update them. Before updating them we create a lock on Redis, update the line item and cache it back. Maximum time a thread waits before acquiring the lock is 60 sec.Now, two threads are trying to acquire the lock at the same time and one of those threads is not able to acquire the lock within its stipulated wait time of 60 sec. In this case, the second thread reads from the cache which is going to be a Dirty Read as the first thread has still not cached the updated object.

We want to avoid this situation. For this, we thought we can increase the Lock Wait time but if we keep it waiting for too long, it can cause a timeout from the application as we are using AWS Redis Cluster.

Is there any other way we can accomplish this?


Viewing all articles
Browse latest Browse all 2222

Trending Articles



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