1. 链接redis

spring boot 默认关闭redis链接,安装redis并配置链接:application.yml

2. 引入缓存jar包

  <dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-cache</artifactId>
	</dependency>

3.在需要缓存的位置 添加注解 @Cacheable

在这里插入图片描述

4. 缓存注解@Cacheable、@CacheEvict、@CachePut详解

  	 参考地址:[https://blog.csdn.net/newbie_907486852/article/details/81478046]
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐