- 缓存要素
缓存到哪里(redis等)
以key-value的方式保存, 确定key
spring cache 框架怎么用?
https://spring.io/guides/gs/caching/
@Cacheable("books")
指定books类型的缓存的具体缓存代码
@EnableCaching
@EnableCaching注释触发一个后处理器(post processor ),它检查每个Spring bean是否存在公共方法(public method)上的缓存注释。 如果找到这样的注释,则自动创建代理以拦截方法调用并相应地处理缓存行为。
The annotation triggers a post processor that inspects (检查)every Spring bean for the presence(存在) of caching annotations on public methods. If such an annotation is found, a proxy is automatically created to intercept the method call and handle the caching behavior accordingly.
The annotations that are managed by this post processor are Cacheable, CachePut and CacheEvict.
@Cacheable @CachePut @CacheEvict
CacheManager
Spring Boot automatically configures a suitable CacheManager to serve as a provider for the relevant (相应的)cache
Spring Boot会自动配置合适的CacheManager作为相关缓存的提供程序