Procházet zdrojové kódy

:zap: 优化缓存清除逻辑

smallchill před 5 roky
rodič
revize
f1b26ef4af

+ 1 - 0
src/main/java/org/springblade/modules/auth/endpoint/BladeTokenEndPoint.java

@@ -133,6 +133,7 @@ public class BladeTokenEndPoint {
 		CacheUtil.clear(MENU_CACHE);
 		CacheUtil.clear(MENU_CACHE);
 		CacheUtil.clear(DICT_CACHE, Boolean.FALSE);
 		CacheUtil.clear(DICT_CACHE, Boolean.FALSE);
 		CacheUtil.clear(MENU_CACHE, Boolean.FALSE);
 		CacheUtil.clear(MENU_CACHE, Boolean.FALSE);
+		CacheUtil.clear(SYS_CACHE, Boolean.FALSE);
 		CacheUtil.clear(PARAM_CACHE, Boolean.FALSE);
 		CacheUtil.clear(PARAM_CACHE, Boolean.FALSE);
 		return Kv.create().set("success", "true").set("msg", "success");
 		return Kv.create().set("success", "true").set("msg", "success");
 	}
 	}

+ 3 - 0
src/main/java/org/springblade/modules/system/controller/RoleController.java

@@ -119,6 +119,7 @@ public class RoleController extends BladeController {
 	@ApiOperation(value = "新增或修改", notes = "传入role")
 	@ApiOperation(value = "新增或修改", notes = "传入role")
 	public R submit(@Valid @RequestBody Role role) {
 	public R submit(@Valid @RequestBody Role role) {
 		CacheUtil.clear(SYS_CACHE);
 		CacheUtil.clear(SYS_CACHE);
+		CacheUtil.clear(SYS_CACHE, Boolean.FALSE);
 		return R.status(roleService.submit(role));
 		return R.status(roleService.submit(role));
 	}
 	}
 
 
@@ -130,6 +131,7 @@ public class RoleController extends BladeController {
 	@ApiOperation(value = "删除", notes = "传入ids")
 	@ApiOperation(value = "删除", notes = "传入ids")
 	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
 	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
 		CacheUtil.clear(SYS_CACHE);
 		CacheUtil.clear(SYS_CACHE);
+		CacheUtil.clear(SYS_CACHE, Boolean.FALSE);
 		return R.status(roleService.removeByIds(Func.toLongList(ids)));
 		return R.status(roleService.removeByIds(Func.toLongList(ids)));
 	}
 	}
 
 
@@ -141,6 +143,7 @@ public class RoleController extends BladeController {
 	@ApiOperation(value = "权限设置", notes = "传入roleId集合以及menuId集合")
 	@ApiOperation(value = "权限设置", notes = "传入roleId集合以及menuId集合")
 	public R grant(@RequestBody GrantVO grantVO) {
 	public R grant(@RequestBody GrantVO grantVO) {
 		CacheUtil.clear(SYS_CACHE);
 		CacheUtil.clear(SYS_CACHE);
+		CacheUtil.clear(SYS_CACHE, Boolean.FALSE);
 		boolean temp = roleService.grant(grantVO.getRoleIds(), grantVO.getMenuIds(), grantVO.getDataScopeIds(), grantVO.getApiScopeIds());
 		boolean temp = roleService.grant(grantVO.getRoleIds(), grantVO.getMenuIds(), grantVO.getDataScopeIds(), grantVO.getApiScopeIds());
 		return R.status(temp);
 		return R.status(temp);
 	}
 	}