mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-21 02:25:56 +08:00
redission处理判断无前缀则不处理
This commit is contained in:
parent
fa31d23226
commit
65786c70a7
@ -139,7 +139,7 @@ spring:
|
||||
|
||||
redisson:
|
||||
# redis key前缀
|
||||
keyPrefix: ruoyi-vue-plus
|
||||
keyPrefix:
|
||||
# 线程池数量
|
||||
threads: 4
|
||||
# Netty线程池数量
|
||||
|
||||
@ -142,7 +142,7 @@ spring:
|
||||
|
||||
redisson:
|
||||
# redis key前缀
|
||||
keyPrefix: ruoyi-vue-plus
|
||||
keyPrefix:
|
||||
# 线程池数量
|
||||
threads: 16
|
||||
# Netty线程池数量
|
||||
|
||||
@ -12,8 +12,9 @@ public class KeyPrefixHandler implements NameMapper {
|
||||
|
||||
private final String keyPrefix;
|
||||
|
||||
//前缀为空 则返回空前缀
|
||||
public KeyPrefixHandler(String keyPrefix) {
|
||||
this.keyPrefix = keyPrefix + ":";
|
||||
this.keyPrefix = StringUtils.isBlank(keyPrefix) ? "" : keyPrefix + ":";
|
||||
}
|
||||
|
||||
//增加前缀
|
||||
@ -22,6 +23,9 @@ public class KeyPrefixHandler implements NameMapper {
|
||||
if (StringUtils.isBlank(name)) {
|
||||
return null;
|
||||
}
|
||||
if (StringUtils.isBlank(keyPrefix)) {
|
||||
return name;
|
||||
}
|
||||
if (!name.startsWith(keyPrefix)) {
|
||||
return keyPrefix + name;
|
||||
} else {
|
||||
@ -35,6 +39,9 @@ public class KeyPrefixHandler implements NameMapper {
|
||||
if (StringUtils.isBlank(name)) {
|
||||
return null;
|
||||
}
|
||||
if (StringUtils.isBlank(keyPrefix)) {
|
||||
return name;
|
||||
}
|
||||
if (name.startsWith(keyPrefix)) {
|
||||
return name.substring(keyPrefix.length());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user