Spring简化的JSRE缓存
SpringCache只需要关注JSRE下的CacheManager(缓存管理器) 和Cache(缓存具体的数据库如redis)
SpringCache下面的四个缓存注解
@EnableCahing
开启基于注解的缓存
如果希望下面三个注解生效就必须先使用 @EnableCahing 开启注解缓存模式
@Cahcheable
针对方法配置,根据方法被传入的参数对其结果进行缓存
User user(Integer id);
@CacheEvict
清空缓存
@CachePut
保证方法被调用,结果被缓存
原文:https://www.cnblogs.com/ycnp/p/11917830.html