public class RedisClient extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static RedisClient |
buildRedisClient(RedisClusterConfig config)
构建集群模式redis客户端
|
static RedisClient |
buildRedisClient(RedisMasterSlaveConfig config)
构建主从模式redis客户端
|
static RedisClient |
buildRedisClient(RedisSingleConfig config)
构建单点模式redis客户端
|
void |
close()
关闭
|
boolean |
tryLock(String key,
Long expiredSeconds)
加锁
|
boolean |
tryReadLock(String key,
Long expiredSeconds)
加读锁
|
boolean |
tryWriteLock(String key,
Long expiredSeconds)
加写锁
|
void |
unlock(String key)
解锁
|
void |
unLockRead(String key)
解开读锁
|
void |
unLockWrite(String key)
解开写锁
|
public void close()
public static RedisClient buildRedisClient(RedisSingleConfig config)
config - 配置信息public static RedisClient buildRedisClient(RedisClusterConfig config)
config - 配置信息public static RedisClient buildRedisClient(RedisMasterSlaveConfig config)
config - 配置信息public boolean tryLock(String key, Long expiredSeconds)
key - 锁keyexpiredSeconds - 过期时间(单位:秒),如果小于等于0,默认30秒public void unlock(String key)
key - 锁keypublic boolean tryReadLock(String key, Long expiredSeconds)
key - 锁keyexpiredSeconds - 过期时间(单位:秒),如果小于等于0,默认30秒public void unLockRead(String key)
key - 锁keypublic boolean tryWriteLock(String key, Long expiredSeconds)
key - 锁keyexpiredSeconds - 过期时间(单位:秒),如果小于等于0,默认30秒public void unLockWrite(String key)
key - 锁keyCopyright © 2023. All rights reserved.