Infinispan , How to assure read write lock on a key/cache

1.4k Views Asked by At

We are planning to use Infinispan in client server mode. The architecture has many clients (client 1, client 2 and so on ) and a distributed infinispan network.

We need to update the data in the cache periodically, say every5 hours . All clients could be able to update the data. If one of them (say client 1) is updating we need to prevent others doing the same job. Once the updating is complete all clients wait another 5 hour and, any of them will do the the updating again.

How to achieve this in infinispan 6?

Thanks in advance.

1

There are 1 best solutions below

3
On

If the clients are on different machines (you run Infinispan as server(s)), you should use HotRod clients to access the cache. There, see the getVersioned and replaceWithVersion methods on RemoteCache.