mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-14 14:19:08 +08:00
Merge branch 'j3_dev' of pigx/pigx into master
This commit is contained in:
commit
fa55191516
2 files changed
+12
No files matched your search
+7
@@ -8,6 +8,13 @@ package com.pig4cloud.pigx.common.core.constant;
|
|||||||
*/
|
*/
|
||||||
public interface CacheConstants {
|
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;
|
package com.pig4cloud.pigx.common.data.cache;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
|
||||||
import com.pig4cloud.pigx.common.data.tenant.TenantContextHolder;
|
import com.pig4cloud.pigx.common.data.tenant.TenantContextHolder;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.cache.Cache;
|
import org.springframework.cache.Cache;
|
||||||
@@ -73,6 +74,10 @@ public class RedisAutoCacheManager extends RedisCacheManager {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Cache getCache(String name) {
|
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);
|
return super.getCache(TenantContextHolder.getTenantId() + StrUtil.COLON + name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user