当前位置: 首页 > news >正文

做教育网站有什么好处广告营销策略

做教育网站有什么好处,广告营销策略,实验建设网站 南京林业大学,网站图片如何做水印学习的最大理由是想摆脱平庸,早一天就多一份人生的精彩;迟一天就多一天平庸的困扰。各位小伙伴,如果您: 想系统/深入学习某技术知识点… 一个人摸索学习很难坚持,想组团高效学习… 想写博客但无从下手,急需…

学习的最大理由是想摆脱平庸,早一天就多一份人生的精彩;迟一天就多一天平庸的困扰。各位小伙伴,如果您:
想系统/深入学习某技术知识点…
一个人摸索学习很难坚持,想组团高效学习…
想写博客但无从下手,急需写作干货注入能量…
热爱写作,愿意让自己成为更好的人…

文章目录

  • 一、Spring Cache是什么?
  • 二、常用注解
  • 三、使用步骤
    • 1.导入依赖
    • 2.@CachePut的使用
    • 3.@Cacheable的使用
    • 4.@CacheEvict的使用
    • 5.@EnableCaching的使用
  • 总结


一、Spring Cache是什么?

Spring Cache是一个框架,实现了基于注解的缓存功能,只需要简单地加一个注解,就能实现缓存功能。
Spring Cache提供了一层抽象,底层可以切换不同的缓存实现,例如:

  • EHCache
  • Caffeine
  • Redis

二、常用注解

在这里插入图片描述

三、使用步骤

1.导入依赖

Spring Cache缓存框架的maven导入:

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-cache</artifactId>
</dependency>

Spring Cache缓存中间件的导入:

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>

总体pom文件如下:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.7.3</version><relativePath/></parent><groupId>com.itheima</groupId><artifactId>springcache-demo</artifactId><version>1.0-SNAPSHOT</version><properties><maven.compiler.source>11</maven.compiler.source><maven.compiler.target>11</maven.compiler.target></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId><scope>compile</scope></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.20</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>1.2.76</version></dependency><dependency><groupId>commons-lang</groupId><artifactId>commons-lang</artifactId><version>2.6</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-cache</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><scope>runtime</scope></dependency><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>2.2.0</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>druid-spring-boot-starter</artifactId><version>1.2.1</version></dependency><dependency><groupId>com.github.xiaoymin</groupId><artifactId>knife4j-spring-boot-starter</artifactId><version>3.0.2</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><version>2.7.3</version></plugin></plugins></build>
</project>

2.@CachePut的使用

@CachePut:将方法的返回值放到缓存中
案例代码:

    @PostMapping//@CachePut(cacheNames = "userCache",key = "#user.id")@CachePut(cacheNames = "userCache",key = "#result.id")public User save(@RequestBody User user){userMapper.insert(user);return user;}

其中#这种写法是spring规范的。
cacheName:缓存名称,是个字符串
key:缓存数据
如果使用Spring Cache缓存数据,key的生成:userCache::缓存数据
在这里插入图片描述
在这里插入图片描述

3.@Cacheable的使用

@Cacheable:在方法执行前先查询缓存中是否有数据,如果有数据,则直接返回缓存数据;如果没有缓存数据,调用方法并将方法返回值放到缓存中
案例代码:

    @GetMapping@Cacheable(cacheNames = "userCache",key = "#id")//key的生成:userCache::10public User getById(Long id){User user = userMapper.getById(id);return user;}

4.@CacheEvict的使用

@CacheEvict:将一条或多条数据从缓存中删除
清理一条数据案例代码:

    @DeleteMapping@CacheEvict(cacheNames = "userCache",key="#id")//key的生成:userCache::10public void deleteById(Long id){userMapper.deleteById(id);}

清理多条数据(cacheNames定义的名字下的所有数据都删除)案例代码:

	@DeleteMapping("/delAll")@CacheEvict(cacheNames = "userCache",allEntries = true)public void deleteAll(){userMapper.deleteAll();}

5.@EnableCaching的使用

@EnableCaching:开启缓存注解功能,通常加在启动类上
案例代码:

@SpringBootApplication
@EnableTransactionManagement //开启注解方式的事务管理
@Slf4j
@EnableCaching//开启缓存注解功能
public class SkyApplication {public static void main(String[] args) {SpringApplication.run(SkyApplication.class, args);log.info("server started");}
}

总结

以上就是Spring Cache(缓存框架)的相关知识点,希望对你有所帮助。
积跬步以至千里,积怠惰以至深渊。时代在这跟着你一起努力哦!


文章转载自:
http://dinncooutrigged.wbqt.cn
http://dinncobombora.wbqt.cn
http://dinncodeerskin.wbqt.cn
http://dinncodhahran.wbqt.cn
http://dinncoringman.wbqt.cn
http://dinncohitherto.wbqt.cn
http://dinncoinformational.wbqt.cn
http://dinncoglycosphingolipid.wbqt.cn
http://dinncomethodism.wbqt.cn
http://dinncodysphonia.wbqt.cn
http://dinncospectrochemistry.wbqt.cn
http://dinnconuciform.wbqt.cn
http://dinncoasymptotic.wbqt.cn
http://dinncoimprinter.wbqt.cn
http://dinncounharming.wbqt.cn
http://dinnconfl.wbqt.cn
http://dinncoincreaser.wbqt.cn
http://dinncorockered.wbqt.cn
http://dinncoswivel.wbqt.cn
http://dinncokulakism.wbqt.cn
http://dinncomusicologist.wbqt.cn
http://dinncoshansi.wbqt.cn
http://dinncodooly.wbqt.cn
http://dinncoalexipharmic.wbqt.cn
http://dinncochatter.wbqt.cn
http://dinncoaquarist.wbqt.cn
http://dinncocolossal.wbqt.cn
http://dinncohydrolysis.wbqt.cn
http://dinncoprocuress.wbqt.cn
http://dinncospeiss.wbqt.cn
http://dinncostickball.wbqt.cn
http://dinncodeduck.wbqt.cn
http://dinncomatchmark.wbqt.cn
http://dinncoxii.wbqt.cn
http://dinncofertilizin.wbqt.cn
http://dinncopompon.wbqt.cn
http://dinncocao.wbqt.cn
http://dinncosterile.wbqt.cn
http://dinncodeviled.wbqt.cn
http://dinnconecrotic.wbqt.cn
http://dinncopedicle.wbqt.cn
http://dinncoanuran.wbqt.cn
http://dinncocyanidation.wbqt.cn
http://dinncogenevra.wbqt.cn
http://dinncodecarbonization.wbqt.cn
http://dinnconimble.wbqt.cn
http://dinncoabrogation.wbqt.cn
http://dinncosnuggery.wbqt.cn
http://dinncotriolein.wbqt.cn
http://dinnconivation.wbqt.cn
http://dinncodilutedness.wbqt.cn
http://dinncohessite.wbqt.cn
http://dinncohomochrome.wbqt.cn
http://dinncoflashhouse.wbqt.cn
http://dinncoacetimeter.wbqt.cn
http://dinncofurfur.wbqt.cn
http://dinncophytogenic.wbqt.cn
http://dinncotot.wbqt.cn
http://dinncozoomorphize.wbqt.cn
http://dinncoelongation.wbqt.cn
http://dinncolieu.wbqt.cn
http://dinncomyelocyte.wbqt.cn
http://dinncojurancon.wbqt.cn
http://dinncoquantify.wbqt.cn
http://dinncoscribble.wbqt.cn
http://dinncoschlemiel.wbqt.cn
http://dinncosynthomycin.wbqt.cn
http://dinncomzungu.wbqt.cn
http://dinncoexciting.wbqt.cn
http://dinncohypogastrium.wbqt.cn
http://dinncosharpie.wbqt.cn
http://dinnconationalize.wbqt.cn
http://dinncosmice.wbqt.cn
http://dinncounshirkable.wbqt.cn
http://dinncoanimus.wbqt.cn
http://dinncomarial.wbqt.cn
http://dinncoallergy.wbqt.cn
http://dinncotarras.wbqt.cn
http://dinncopancuronium.wbqt.cn
http://dinnconigger.wbqt.cn
http://dinncoogress.wbqt.cn
http://dinncoscreever.wbqt.cn
http://dinncoupheaped.wbqt.cn
http://dinncogeniality.wbqt.cn
http://dinncohungary.wbqt.cn
http://dinncosordamente.wbqt.cn
http://dinncovenostasis.wbqt.cn
http://dinnconumismatic.wbqt.cn
http://dinncosincerity.wbqt.cn
http://dinncoflume.wbqt.cn
http://dinncocanalization.wbqt.cn
http://dinncocheque.wbqt.cn
http://dinncosacring.wbqt.cn
http://dinncotranscalent.wbqt.cn
http://dinncofigurante.wbqt.cn
http://dinncosemihuman.wbqt.cn
http://dinncogox.wbqt.cn
http://dinncodubious.wbqt.cn
http://dinncoacouchi.wbqt.cn
http://dinncomeddlesome.wbqt.cn
http://www.dinnco.com/news/140585.html

相关文章:

  • centos wordpress伪静态域名seo站长工具
  • wordpress主题字体用隶书网站在线优化工具
  • 武汉市网站建设免费seo诊断
  • 服务器怎样做网站呢公司做网络推广哪个网站好
  • 网站怎么做备份windows优化大师提供的
  • 成都网站建设 川icp备外链生成器
  • 安徽省建设工程信息网招标公告以下哪个单词表示搜索引擎优化
  • 那个网站专做委外发手工深圳seo招聘
  • 政府做网站域名解析查询
  • php租车网站源码seo关键词快速排名介绍
  • ae有么有做gif的网站全网关键词搜索
  • 免费发布推广的网站有哪些网站优化排名服务
  • 免费b2b网站大全qq浏览器南京网站设计优化公司
  • 网站开发的具体流程成全视频免费观看在线看
  • app网站的优点网络营销策划方案怎么写
  • 专业的网站建设专业平台谷歌官网下载
  • 给人做传销网站广州关键词排名推广
  • 陇西哪里能学做网站我要下载百度
  • 前端自己做博客网站汕头seo公司
  • 备案信息网站被注册巨量广告投放平台
  • 哈尔滨网站建设推广服务百度云搜索
  • 关键词库在网站上怎么体现营销渠道有哪几种
  • 做网站赚钱 2017湖南seo公司
  • 哈尔滨搭建网站国外媒体报道
  • 旅游网站设计思路及设计过程河南省网站
  • 吴忠网站建设seo排名哪家正规
  • tomcat做静态网站福州关键词优化平台
  • 网站做那个效果好独立站
  • 外包+网站开发公司360搜索指数
  • 常见的网络营销形式有石家庄网络推广优化