public class LockUtils extends Object
| 构造器和说明 |
|---|
LockUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static org.noear.redisx.RedisClient |
getClient() |
static String |
getLockValue(String group,
String key) |
static boolean |
isLocked(String group,
String key)
检查 group_key 是否已被锁定
|
static boolean |
tryLock(String group,
String key)
尝试把 group_key 锁定 (3秒)
|
static boolean |
tryLock(String group,
String key,
int inSeconds)
尝试把 group_key 锁定
|
static boolean |
tryLock(String group,
String key,
int inSeconds,
String inMaster)
尝试把 group_key 锁定给 inMaster
|
static void |
unLock(String group,
String key)
解锁 group_key
|
static void |
unLock(String group,
String key,
String inMaster)
解锁 group_key
|
public static org.noear.redisx.RedisClient getClient()
public static boolean tryLock(String group, String key, int inSeconds, String inMaster)
group - 分组key - 关键字inSeconds - 锁定时间inMaster - 锁持有人public static boolean tryLock(String group, String key, int inSeconds)
inSeconds - 锁定时间Copyright © 2023. All rights reserved.