public class RedisLock extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
RedisLock.Builder |
| Modifier and Type | Method and Description |
|---|---|
void |
lock(String key,
String request)
blocking lock
|
boolean |
lock(String key,
String request,
int blockTime)
blocking lock,custom time
|
boolean |
tryLock(String key,
String request)
Non-blocking lock
|
boolean |
tryLock(String key,
String request,
int expireTime)
Non-blocking lock
|
boolean |
unlock(String key,
String request)
unlock
|
public boolean tryLock(String key, String request)
key - lock business typerequest - valuepublic void lock(String key, String request) throws InterruptedException
key - request - InterruptedExceptionpublic boolean lock(String key, String request, int blockTime) throws InterruptedException
key - request - blockTime - custom timeInterruptedExceptionpublic boolean tryLock(String key, String request, int expireTime)
key - lock business typerequest - valueexpireTime - custom expireTimeCopyright © 2018. All rights reserved.