借用@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; }
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/208217.html原文链接:https://javaforall.net
