mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-08 12:39:05 +08:00
Merge branch 'master' of https://gitee.ltd/pigx/pigx
This commit is contained in:
commit
a5da09d021
2 files changed
+12
No files matched your search
+7
@@ -8,6 +8,13 @@ package com.pig4cloud.pigx.common.core.constant;
|
||||
*/
|
||||
public interface CacheConstants {
|
||||
|
||||
/**
|
||||
* 全局缓存,在缓存名称上加上该前缀表示该缓存不区分租户,比如:
|
||||
* <P/>
|
||||
* {@code @Cacheable(value = CacheConstants.GLOBALLY+CacheConstants.MENU_DETAILS, key = "#roleId + '_menu'", unless = "#result == null")}
|
||||
*/
|
||||
String GLOBALLY = "gl@";
|
||||
|
||||
/**
|
||||
* 菜单信息缓存
|
||||
*/
|
||||
|
||||
+5
@@ -18,6 +18,7 @@
|
||||
package com.pig4cloud.pigx.common.data.cache;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
|
||||
import com.pig4cloud.pigx.common.data.tenant.TenantContextHolder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.Cache;
|
||||
@@ -73,6 +74,10 @@ public class RedisAutoCacheManager extends RedisCacheManager {
|
||||
*/
|
||||
@Override
|
||||
public Cache getCache(String name) {
|
||||
// see https://gitee.wang/pig/pigx/issues/613
|
||||
if(name.startsWith(CacheConstants.GLOBALLY)){
|
||||
return super.getCache(name);
|
||||
}
|
||||
return super.getCache(TenantContextHolder.getTenantId() + StrUtil.COLON + name);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user