springboot整合cache缓存

发布时间 2023-06-16 11:53:09作者: 娶个好听的名字

第一步:在 pom.xml 文件中导入对应坐标

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

第二步:启用缓存 在启动类是加上  @EnableCaching 注解以 开启缓存功能

 第三步:在对应的实现类上 设置当前操作的结果进入缓存

 完成!!