我試圖緩存Short值與@Cacheable。 @EnableAutoConfiguration
@EnableCaching
public class Config {
@Bean
public CacheManager cacheManager() {
return new ConcurrentMapCacheManager();
}
}
@
請參閱Spring Cache可用於緩存服務調用。 特別在下面的XML片段: <!-- the service we want to make cacheable -->
<bean id="bookService" class="x.y.service.DefaultBookService"/>
<!-- cache definitions -->
<cache:advice id="c
我想了解Spring的緩存如何工作,特別是與事務和更多線程一起工作。 讓我們的服務緩存其結果 public class ServiceWithCaching {
@Cacheable(value="my-cache")
public String find() {
...load from DB
}
@CacheEvict(value="my