Skip to content

Commit

Permalink
update 优化 redis操作 如果无法忽略租户id则全局处理
Browse files Browse the repository at this point in the history
  • Loading branch information
JavaLionLi committed Sep 19, 2024
1 parent e6a765c commit 77bf538
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ public static long decrAtomicValue(String key) {
}

/**
* 获得缓存的基本对象列表
* 获得缓存的基本对象列表(全局匹配忽略租户 自行拼接租户id)
*
* @param pattern 字符串前缀
* @return 对象列表
Expand All @@ -528,7 +528,7 @@ public static Collection<String> keys(final String pattern) {
}

/**
* 删除缓存的基本对象列表
* 删除缓存的基本对象列表(全局匹配忽略租户 自行拼接租户id)
*
* @param pattern 字符串前缀
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public String map(String name) {
}
String tenantId = TenantHelper.getTenantId();
if (StringUtils.isBlank(tenantId)) {
log.error("无法获取有效的租户id -> Null");
log.debug("无法获取有效的租户id -> Null");
return super.map(name);
}
if (StringUtils.startsWith(name, tenantId + "")) {
// 如果存在则直接返回
Expand All @@ -61,7 +62,8 @@ public String unmap(String name) {
}
String tenantId = TenantHelper.getTenantId();
if (StringUtils.isBlank(tenantId)) {
log.error("无法获取有效的租户id -> Null");
log.debug("无法获取有效的租户id -> Null");
return super.unmap(name);
}
if (StringUtils.startsWith(unmap, tenantId + "")) {
// 如果存在则删除
Expand Down

0 comments on commit 77bf538

Please sign in to comment.