寫在前面
1.為什麼要用緩存
當需要提高效率,速度的情況下都可以考慮使用緩存
①網絡請求緩存
②資料庫查詢緩存
③Redis查詢緩存
④CDN緩存
當然,緩存使用的地方還有很多,今天寫一寫關于Spring Boot Cache的從入門到精通不完全指南
Spring Cache
什麼是Spring Cache
spring chache官方文檔
什麼是Spring Boot Cache
Spring Boot Caching Provider 官方連結
如何使用
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
在 spring boot autoconfigure 中搜尋
相關源碼 --> org.springframework.boot.autoconfigure.cache
如:org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration