import com.alicp.jetcache.anno.CacheInvalidate; import com.alicp.jetcache.anno.CacheUpdate; import com.alicp.jetcache.anno.Cached; import org.springframework.boot.autoconfigure.security.SecurityProperties; import org.springframework.stereotype.Component; @Component public class TestCache { @Cached(name = "test.", cacheNullValue = true) public SecurityProperties.User load(SecurityProperties.User tokenVo) { return tokenVo; } /** * 保存接口请求日志 * * @param tokenVo */ @CacheUpdate(name = "test.", key = "args[0].token", value = "#tokenVo") public String save(SecurityProperties.User tokenVo) { return tokenVo.getName(); } /** * 保存接口请求日志 * * @param tokenVo 请求数据 * @retur 保存主键 */ @CacheInvalidate(name = "test.", key = "args[0].token") public int remove(SecurityProperties.User tokenVo) { return 0; } }