@EnableCaching

https://docs.spring.io/spring/docs/3.0.6.RELEASE_to_3.1.0.BUILD-SNAPSHOT/3.1.0.BUILD-SNAPSHOT/org/springframework/cache/annotation/EnableCaching.html

  1. 缓存要素
    缓存到哪里(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作为相关缓存的提供程序

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值