mirror of
https://gitee.com/jeelowcode/JeeLowCode.git
synced 2026-06-10 00:27:42 +08:00
登录成功后清空缓存
This commit is contained in:
@@ -26,10 +26,10 @@ public class TenantRedisCacheManager extends TimeoutRedisCacheManager {
|
||||
@Override
|
||||
public Cache getCache(String name) {
|
||||
// 如果开启多租户,则 name 拼接租户后缀
|
||||
if (!TenantContextHolder.isIgnore()
|
||||
/*if (!TenantContextHolder.isIgnore()
|
||||
&& TenantContextHolder.getTenantId() != null) {
|
||||
name = name + ":" + TenantContextHolder.getTenantId();
|
||||
}
|
||||
}*/
|
||||
|
||||
// 继续基于父方法
|
||||
return super.getCache(name);
|
||||
|
||||
@@ -110,12 +110,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
}
|
||||
//清空缓存
|
||||
permissionService.clearCache(user.getId());
|
||||
permissionService.clearCacheIgnoreTenant(user.getId());
|
||||
try{
|
||||
Thread.sleep(2000L);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
// 创建 Token 令牌,记录登录日志
|
||||
return createTokenAfterLoginSuccess(user.getId(), reqVO.getUsername(), LoginLogTypeEnum.LOGIN_USERNAME);
|
||||
}
|
||||
|
||||
@@ -146,6 +146,4 @@ public interface PermissionService {
|
||||
//清除缓存
|
||||
Boolean clearCache(Long userId);
|
||||
|
||||
//清除缓存忽略租户
|
||||
Boolean clearCacheIgnoreTenant(Long userId);
|
||||
}
|
||||
|
||||
@@ -360,18 +360,6 @@ public class PermissionServiceImpl implements PermissionService {
|
||||
return true;
|
||||
}
|
||||
|
||||
//清除缓存忽略租户
|
||||
@TenantIgnore
|
||||
public Boolean clearCacheIgnoreTenant(Long userId){
|
||||
try{
|
||||
PermissionServiceImpl bean = SpringUtil.getBean(PermissionServiceImpl.class);
|
||||
bean.clearCache(userId);
|
||||
Thread.sleep(500L);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得自身的代理对象,解决 AOP 生效问题
|
||||
|
||||
Reference in New Issue
Block a user