缓存上的spring注释

时间:2013-09-15 17:03:08

标签: spring spring-mvc ehcache

我是spring和ehcache的新手,我在春天看过一些教程并配置了ehcache annonation,但缓存没有加载来自DB的检索记录。以下是代码

@Cacheable(value="vehicles", key="#type")
public @ResponseBody
    List<Device> getVehicles(@RequestParam(value = "vehicletype") int type,
            Model uiModel) {

if (type > 0)
            return service.findByType(type);
        else
            return service.findAll();
}   

我启用了查询级缓存和二级缓存。

任何人都可以帮助我解决这个问题吗? 提前谢谢。

0 个答案:

没有答案