我正在尝试实现缓存以避免多次调用Rest API。以下是API call
的实施代码。我不是每次都调用API,而是将API
结果放在hashmap中,使用payload对象作为键,结果作为值。我尝试了不同的方法,但我无法找到解决方案。拜托,请帮帮我。
@Bean
public IntegrationFlow read() {
return IntegrationFlows.from("input").split(new PayLoadSplitter()).enrichHeaders(p -> p.header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML))
.handle(Http.outboundGateway("http://localhost:8080/service/publications/{name}")
.httpMethod(HttpMethod.GET).expectedResponseType(String.class).uriVariable("name", p->p.getPayload())).aggregate().get();
}