Are redisson collections "distributed" safe?

51 views Asked by At

I can't get from the documentation if they actually are.

For instance, if I get a queue, can two (or more) different JVM's read from it and get different values?

e.g. the following code running on different JVM's

RQueue<String> queue = redis.getQueue(KEY);
queue.poll();

Would every JVM get a different value (granted the content of the queue are different) or do I need a to lock first?

e.g.

RLock lock = redis.getLock(LOCK_KEY);
lock.lock();
try {
   RQueue<String> queue = redis.getQueue(KEY);
   queue.poll(); 
} finally {
    lock.unlock();
}
0

There are 0 answers