首页 > 编程语言 > 详细

Spring---数据缓存Cache

时间:2019-11-27 12:00:01      阅读:42      评论:0      收藏:0      [点我收藏+]

1、Spring缓存支持

    1.1、Spring定义了org.springframework.cache.CacheManager类、org.springframework.cache.Cache类接口来统一不同的缓存技术;

          CacheManager

              Spring提供的  各种缓存技术  抽象接口

          Cache

              Cache接口包含  缓存的各种操作(add,remove,get)

    1.2、Spring支持的CacheManager

          技术分享图片

 

          a,在使用任意一个CacheManager的实现类时,需要注册实现的CacheManager的Bean

    1.3、声明式缓存注解

          Spring提供了4个注解   声明缓存规则

          技术分享图片

 

     1.4、开启声明式缓存支持

          只需要  在配置类上   使用@EnableCaching注解即可;

 

package com.an.cache;

import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Configuration;

/**
 * @description:
 * @author: anpeiyong
 * @date: Created in 2019/11/27 10:29
 * @since:
 */
@Configuration
@EnableCaching
public class CacheConfig {
    
}

  

     

 

Spring---数据缓存Cache

原文:https://www.cnblogs.com/anpeiyong/p/11940300.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!