s-sathish / redlock-java

RedLock implementation in Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

redlock-java

RedLock in Java

Implementation based on Redlock-rb

This Java library implements the Redis-based distributed lock manager algorithm described in this blog post.

Include the dependency into your project:

<dependency>
  <groupId>io.github.s-sathish</groupId>
  <artifactId>redlock-java</artifactId>
  <version>1.0.4</version>
</dependency>

To create a lock manager:

RedLock redLock = new RedLock();

To acquire a lock:

LockResult lockResult = redLock.lock("redlock");

To release a lock:

redLock.release("redlock", lockResult.getValue());

About

RedLock implementation in Java

License:MIT License


Languages

Language:Java 100.0%