在springboot使用spring如何实现缓存cache-创新互联
本篇文章为大家展示了在springboot使用spring 如何实现缓存cache,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。
声明式缓存
Spring 定义 CacheManager 和 Cache 接口用来统一不同的缓存技术。例如 JCache、 EhCache、 Hazelcast、 Guava、 Redis 等。在使用 Spring 集成 Cache 的时候,我们需要注册实现的 CacheManager 的 Bean。
Spring Boot 为我们自动配置了 JcacheCacheConfiguration、 EhCacheCacheConfiguration、HazelcastCacheConfiguration、GuavaCacheConfiguration、RedisCacheConfiguration、SimpleCacheConfiguration 等。
默认使用 ConcurrenMapCacheManager
在我们不使用其他第三方缓存依赖的时候,springboot自动采用ConcurrenMapCacheManager作为缓存管理器。
环境依赖
在pom文件引入spring-boot-starter-cache环境依赖:
org.springframework.boot spring-boot-starter-cache
文章名称:在springboot使用spring如何实现缓存cache-创新互联
网页地址:http://ybzwz.com/article/dhdipj.html