springBoot 中redis 注解缓存的使用

 

1,首先在启动类上加上 

@EnableCaching 这个注解

 

在查询类的controller,或service ,dao 中方法上加
@Cacheable

更新或修改方法上加 

@CachePut

注意 同一个返回对象中  两个注解的  

cacheNames值保持一致

在yaml 文件配置redis

 

pom.xml 引入

 





posted @ 2019-03-22 15:38  逆风$飞翔  阅读(136)  评论(0编辑  收藏  举报