Skip to content

s-sathish/redlock-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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());