spring中CacheEvict无效呢?

在springmvc spring项目中@CacheEvict清除不了缓存呢?
@CacheEvict(value = CacheConstant.CATEGORIES, allEntries = true)

使用@CacheEvict注解的方法必须是controller层直接调用,service里间接调用不生效

你把@CacheEvict的方法和@Cache的方法放到一个java文件中写,他俩在两个java文件的话,会导致@CacheEvict失效

http://blog.csdn.net/sanjay_f/article/details/47372967

返回值设置为**void**试试

@CacheEvict annotation

It is important to note that void methods can be used with @CacheEvict

原因是因为key值跟你查询方法的key值不统一,所以导致缓存并没有清除