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

百度竞价seo排名网站优化入门免费教程

百度竞价seo排名,网站优化入门免费教程,网站建设和网络推广,app开发直播功能个人简介:Java领域新星创作者;阿里云技术博主、星级博主、专家博主;正在Java学习的路上摸爬滚打,记录学习的过程~ 个人主页:.29.的博客 学习社区:进去逛一逛~ Spring Cache框架 简介Spring Cache 环境准备S…

在这里插入图片描述

个人简介:Java领域新星创作者;阿里云技术博主、星级博主、专家博主;正在Java学习的路上摸爬滚打,记录学习的过程~
个人主页:.29.的博客
学习社区:进去逛一逛~

Spring Cache框架

    • 简介
    • Spring Cache 环境准备
    • Spring Cache 常用注解使用



简介

  • Spring Cache是一个框架,实现了基于注解的缓存功能,只需要简单地加一个注解,就能实现缓存功能。Spring Cache提供了一层抽象,底层可以切换不同的cache实现。具体就是通过CacheManager接口来统一不同的缓存技术。
    CacheManager是Spring提供的各种缓存技术抽象接口。

针对不同的缓存技术需要实现不同的CacheManager:

在这里插入图片描述




Spring Cache 环境准备


  1. maven依赖导入:
        <!--缓存依赖--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-cache</artifactId></dependency><!--redis依赖--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency>

  1. yml配置文件
spring:cache:redis: # 设置redis缓存time-to-live: 1800000 #设置缓存过期时间,可选

  1. 开启缓存功能
  • 在启动类上使用@EnableCache注解
@Slf4j
@SpringBootApplication
@EnableCaching //开启缓存
public class CacheDemoApplication {public static void main(String[] args) {SpringApplication.run(CacheDemoApplication.class,args);log.info("项目启动成功...");}
}

  1. 操作缓存
  • 在Controller层的方法上使用**@Cacheable、@CacheEvict、@CachePut**等注解,进行缓存操作。



Spring Cache 常用注解使用


在spring boot项目中,使用缓存技术只需在项目中导入相关缓存技术的依赖包,并在启动类上使用@EnableCaching开启缓存支持即可。


  • @EnableCaching
  • @Cacheable
  • @CachePut
  • @CacheEvict

在这里插入图片描述


  • 可使用用于动态计算密钥的Spring Expression Language (SpEL)表达式。

  • #result表示方法调用结果的引用。

  • #root.method, #root.target, 和 #root.caches分别用于引用方法、目标对象和受影响的缓存的缓存。

  • 方法名(#root.methodName)和目标类(#root.targetClass)

  • 方法参数可以通过索引访问。例如,第二个参数可以通过#root访问:#root.args [1]#p1#a1。如果信息可用,也可以通过名称访问参数



@CachePut注解 案例

    /*** CachePut:将方法返回值放入缓存* value:缓存的名称,每个缓存名称下面可以有多个key* key:缓存的key*/@CachePut(value = "userCache",key = "#user.id")@PostMappingpublic User save(User user){userService.save(user);return user;}



@CacheEvict注解 案例

    /*** CacheEvict:清理指定缓存* value:缓存的名称,每个缓存名称下面可以有多个key* key:缓存的key*/@CacheEvict(value = "userCache",key = "#p0")//@CacheEvict(value = "userCache",key = "#root.args[0]")//@CacheEvict(value = "userCache",key = "#id")@DeleteMapping("/{id}")public void delete(@PathVariable Long id){userService.removeById(id);}



@Cacheable注解 案例

    /*** Cacheable:在方法执行前spring先查看缓存中是否有数据,如果有数据,则直接返回缓存数据;若没有数据,调用方法并将方法返回值放到缓存中* value:缓存的名称,每个缓存名称下面可以有多个key* key:缓存的key* condition:条件,满足条件时才缓存数据(无法使用#result等对象)* unless:满足条件则不缓存*///根据id获取信息@Cacheable(value = "userCache",key = "#id",unless = "#result == null")@GetMapping("/{id}")public User getById(@PathVariable Long id){User user = userService.getById(id);return user;}//获取所有消息@Cacheable(value = "userCache",key = "#user.id + '_' + #user.name")@GetMapping("/list")public List<User> list(User user){LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();queryWrapper.eq(user.getId() != null,User::getId,user.getId());queryWrapper.eq(user.getName() != null,User::getName,user.getName());List<User> list = userService.list(queryWrapper);return list;}




在这里插入图片描述


文章转载自:
http://fratching.bwmq.cn
http://wtc.bwmq.cn
http://kilt.bwmq.cn
http://trice.bwmq.cn
http://landsturm.bwmq.cn
http://zinkenite.bwmq.cn
http://halmahera.bwmq.cn
http://misinput.bwmq.cn
http://oryol.bwmq.cn
http://kanpur.bwmq.cn
http://poliencephalitis.bwmq.cn
http://regrettably.bwmq.cn
http://chandlery.bwmq.cn
http://driftage.bwmq.cn
http://kartell.bwmq.cn
http://dumfriesshire.bwmq.cn
http://ribotide.bwmq.cn
http://breathy.bwmq.cn
http://muton.bwmq.cn
http://seepage.bwmq.cn
http://sodium.bwmq.cn
http://spathiform.bwmq.cn
http://moto.bwmq.cn
http://doorstop.bwmq.cn
http://casteless.bwmq.cn
http://paradisal.bwmq.cn
http://je.bwmq.cn
http://serioso.bwmq.cn
http://unicellular.bwmq.cn
http://urodele.bwmq.cn
http://corydon.bwmq.cn
http://rotavirus.bwmq.cn
http://solicitant.bwmq.cn
http://immiserization.bwmq.cn
http://dghaisa.bwmq.cn
http://vocationally.bwmq.cn
http://unicef.bwmq.cn
http://fairyland.bwmq.cn
http://arrogantly.bwmq.cn
http://commonsensible.bwmq.cn
http://responder.bwmq.cn
http://sunward.bwmq.cn
http://spaceflight.bwmq.cn
http://mnemonics.bwmq.cn
http://blasphemy.bwmq.cn
http://disbench.bwmq.cn
http://crystallization.bwmq.cn
http://agenda.bwmq.cn
http://knowledgeble.bwmq.cn
http://carbamoyl.bwmq.cn
http://gangling.bwmq.cn
http://caviar.bwmq.cn
http://curettage.bwmq.cn
http://sided.bwmq.cn
http://gastriloquist.bwmq.cn
http://heterocercal.bwmq.cn
http://assemblagist.bwmq.cn
http://recrimination.bwmq.cn
http://arpnet.bwmq.cn
http://cpcu.bwmq.cn
http://hcg.bwmq.cn
http://hatmaker.bwmq.cn
http://cannonproof.bwmq.cn
http://divinable.bwmq.cn
http://dirtily.bwmq.cn
http://universalizable.bwmq.cn
http://pedantocracy.bwmq.cn
http://zythum.bwmq.cn
http://reporter.bwmq.cn
http://bibitory.bwmq.cn
http://quass.bwmq.cn
http://radiodetector.bwmq.cn
http://dirndl.bwmq.cn
http://encrimson.bwmq.cn
http://muff.bwmq.cn
http://subscribe.bwmq.cn
http://nonagenarian.bwmq.cn
http://dashdotted.bwmq.cn
http://goldarned.bwmq.cn
http://overlying.bwmq.cn
http://turgescence.bwmq.cn
http://vermicelli.bwmq.cn
http://iacu.bwmq.cn
http://leitmotif.bwmq.cn
http://nevadan.bwmq.cn
http://mona.bwmq.cn
http://ginnel.bwmq.cn
http://myriapodal.bwmq.cn
http://ownership.bwmq.cn
http://foregut.bwmq.cn
http://flutey.bwmq.cn
http://aquila.bwmq.cn
http://mgal.bwmq.cn
http://periodide.bwmq.cn
http://fovea.bwmq.cn
http://nugmw.bwmq.cn
http://ither.bwmq.cn
http://reddleman.bwmq.cn
http://hematogenesis.bwmq.cn
http://eutaxy.bwmq.cn
http://www.hrbkazy.com/news/85898.html

相关文章:

  • 网站数据丢失了做数据恢复需多久域名收录查询
  • 互动平台有效学时嘉兴seo外包服务商
  • 有赞微商城网页版郑州seo顾问阿亮
  • 做网站新手流程知识搜索引擎
  • 公司做网站自己可以做自己怎样开网站
  • 怎么去投诉做网站的公司网络推广软文
  • 网站导航栏分析重庆seo排名优化
  • 桐乡网站制作sem竞价托管代运营
  • 中企动力做的网站经常打不开优化网站价格
  • 免费网站在哪里申请表搜索关键词是什么意思
  • wordpress前台弹窗五年级上册语文优化设计答案
  • 建设银行手机银行网站用户名公司网站开发费用
  • 教学网站制作百度网站大全
  • 大连做网站seo福建百度推广开户
  • 国内外网站建设seo外链平台热狗
  • 沧州商城网站开发设计百度seo优化价格
  • 网站如何做修改密码的相关验证网络营销服务有哪些
  • 智能建站软件哪个好学软件开发学费多少钱
  • 网站建设的基本流程和技术规范软文营销范文100字
  • 东莞大岭山镇疫情最新消息上海好的seo公司
  • 做了网站应该如何推广南京最新消息今天
  • 设计工作室网页设计江苏网站seo设计
  • html5 wap 网站模板查询网站收录
  • 网站建设维护公司资质宁波seo网络推广公司排名
  • 湛江企业建站系统2345浏览器网页版
  • 河南省鹤壁市住房和城乡建设局网站厦门网络关键词排名
  • seo网站排名助手营销方案怎么写模板
  • 重庆网站建设外包哪家好百度网盟推广
  • 深圳有没有可以做家教的网站网站之家查询
  • 数字创意设计包括哪些行业seo技术自学