| 构造器和说明 |
|---|
RedisLocker(org.springframework.data.redis.core.RedisTemplate<Object,Object> redisTemplate)
Constructs a new redis locker with default expire time and redis template
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
setDefaultExpireTime(long expireTime)
Set default expire time of the lock(millisecond)
|
long |
tryLock(String lockKey)
Try get lock, default lock expire time is 4s
|
long |
tryLock(String lockKey,
long lockExpireTime)
Try get lock, and set lock expire time(millisecond)
|
void |
unLock(String lockKey,
long lockReleaseTime)
Release the lock, check the lock has expired(millisecond)
|
public long tryLock(String lockKey)
Lockerpublic long tryLock(String lockKey, long lockExpireTime)
Lockerpublic void unLock(String lockKey, long lockReleaseTime)
Lockerpublic void setDefaultExpireTime(long expireTime)
expireTime - the expire time of lockCopyright © 2019. All rights reserved.