借用@Caching实现
入参是基本类型的:
@Caching(evict={@CacheEvict(value = Cache.CONSTANT, key = "'" + CacheKey.SINGLE_ROLE_NAME + "'+#roleId"),
@CacheEvict(value = Cache.CONSTANT, key = "'" + CacheKey.ROLES_NAME + "'+#roleId"),
@CacheEvict(value = Cache.CONSTANT, key = "'" + CacheKey.SINGLE_ROLE_NAME + "'+#roleId")})
public ResponseData remove(@RequestParam Long roleId) {
………………
}
入参是对象的:
@Caching(evict={@CacheEvict(value = Cache.CONSTANT, key = "'" + CacheKey.SINGLE_ROLE_NAME + "'+#roleDto.roleId"),
@CacheEvict(value = Cache.CONSTANT, key = "'" + CacheKey.ROLES_NAME + "'+#roleDto.roleId"),
@CacheEvict(value = Cache.CONSTANT, key = "'" + CacheKey.SINGLE_ROLE_NAME + "'+#roleDto.roleId")})
public ResponseData edit(RoleDto roleDto) {
this.roleService.editRole(roleDto);
return SUCCESS_TIP;
————————————————
版权声明:本文为CSDN博主「Amy371」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/Amy126/article/details/88661773