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

wordpress怎么做说说深圳网站设计专业乐云seo

wordpress怎么做说说,深圳网站设计专业乐云seo,在国外怎么做网站,门户网站建设与开发目录 Spring Boot中集成Redis 1.项目创建和环境配置 2.基本操作演示 Spring Boot中集成Redis Spring社区也自定义了一套Redis的客户端,与jedis的操作方式有所差异,Spring中把每个类型的操作都单独封装了起来。下面就让我来带大家了解如何在Spring Boot…

目录

Spring Boot中集成Redis

1.项目创建和环境配置

2.基本操作演示


Spring Boot中集成Redis

        Spring社区也自定义了一套Redis的客户端,与jedis的操作方式有所差异,Spring中把每个类型的操作都单独封装了起来。下面就让我来带大家了解如何在Spring Boot项目中使用Redis。

1.项目创建和环境配置

1.第一步创建Spring Boot项目,在创建项目时勾选NoSQL中的Spring Data Redis,然后等待项目加载。

 2.第二步在application.yml中配置Redis服务地址

spring:data:redis:host: 127.0.0.1port: 8888

如果需要进行redis集群的配置可以使用下面的配置项:

spring:data:redis:cluster:nodes:- 172.30.0.101:6379- 172.30.0.102:6379- 172.30.0.103:6379- 172.30.0.104:6379- 172.30.0.105:6379- 172.30.0.106:6379- 172.30.0.107:6379- 172.30.0.108:6379- 172.30.0.109:6379lettuce:cluster:refresh:adaptive: trueperiod: 2000

      下⽅的 lettuce 系列配置,⽬的是为了⾃动刷新集群的拓扑结构。当集群中有节点宕机/加⼊新节点之后, 我们的代码能够⾃动感知到集群的变化。由于上述 ip 都是 docker 容器的 ip, 在 windows 主机上不能直接访问。因此需要把程序打成 jar 包, 部署到 linux 上,再通过 java -jar [jar包名] 的⽅式执⾏。

 3.第三步引入StringRedisTemplate实例,便可以通过redisTemplate进行Redis的相关操作了。

@RestController
public class MyController {@Autowiredprivate StringRedisTemplate redisTemplate;
}

2.基本操作演示

1.String类型操作演示:

@RestController
public class MyController {@Autowiredprivate StringRedisTemplate redisTemplate;@GetMapping("/testString")public String testString(){redisTemplate.opsForValue().set("key","value");String value = redisTemplate.opsForValue().get("key");System.out.println(value);redisTemplate.delete("key");return "OK";}
}

在上述代码中,我们通过调用redisTemplate的opsForValue方法可以得到一个专门操作Redis中String类型的对象,通过这个对象的操作我们便可以得到如下结果:

 2.List类型操作演示:

    @GetMapping("/testList")@ResponseBodypublic String testList() {redisTemplate.opsForList().leftPush("key", "a");redisTemplate.opsForList().leftPushAll("key", "b", "c", "d");List<String> values = redisTemplate.opsForList().range("key", 1, 2);System.out.println(values);redisTemplate.delete("key");return "OK";}

在上述代码中,我们通过调用redisTemplate的opsForList方法可以得到一个专门操作Redis中List类型的对象,通过这个对象的操作我们便可以得到如下结果: 

3.Set类型操作演示:

    @GetMapping("/testSet")@ResponseBodypublic String testSet() {redisTemplate.opsForSet().add("key", "aaa", "bbb", "ccc");boolean ok = redisTemplate.opsForSet().isMember("key", "aaa");System.out.println(ok);redisTemplate.opsForSet().remove("key", "aaa");long n = redisTemplate.opsForSet().size("key");System.out.println(n);redisTemplate.delete("key");return "OK";}

在上述代码中,我们通过调用redisTemplate的opsForSet方法可以得到一个专门操作Redis中Set类型的对象,通过这个对象的操作我们便可以得到如下结果: 

4.Hash类型操作演示:

    @GetMapping("/testHashmap")@ResponseBodypublic String testHashmap() {redisTemplate.opsForHash().put("key", "name", "zhangsan");String value = (String) redisTemplate.opsForHash().get("key", "name");System.out.println(value);redisTemplate.opsForHash().delete("key", "name");boolean ok = redisTemplate.opsForHash().hasKey("key", "name");System.out.println(ok);redisTemplate.delete("key");return "OK";}

在上述代码中,我们通过调用redisTemplate的opsForHash方法可以得到一个专门操作Redis中Hash类型的对象,通过这个对象的操作我们便可以得到如下结果: 

5.Sorted Set类型操作演示:

    @GetMapping("/testZSet")@ResponseBodypublic String testZSet() {redisTemplate.opsForZSet().add("key", "吕布", 100);redisTemplate.opsForZSet().add("key", "赵云", 98);redisTemplate.opsForZSet().add("key", "典⻙", 95);Set<String> values = redisTemplate.opsForZSet().range("key", 0, 2);System.out.println(values);long n = redisTemplate.opsForZSet().count("key", 95, 100);System.out.println(n);redisTemplate.delete("key");return "OK";}

在上述代码中,我们通过调用redisTemplate的opsForZSet方法可以得到一个专门操作Redis中Sorted Set类型的对象,通过这个对象的操作我们便可以得到如下结果: 


文章转载自:
http://lovemaking.xsfg.cn
http://chase.xsfg.cn
http://stunt.xsfg.cn
http://referable.xsfg.cn
http://knickknackery.xsfg.cn
http://excitonics.xsfg.cn
http://shifta.xsfg.cn
http://foolish.xsfg.cn
http://racy.xsfg.cn
http://wain.xsfg.cn
http://colleaguesmanship.xsfg.cn
http://anapurna.xsfg.cn
http://whimsicality.xsfg.cn
http://ausform.xsfg.cn
http://inosculate.xsfg.cn
http://kakotopia.xsfg.cn
http://inhabit.xsfg.cn
http://wisla.xsfg.cn
http://viewsite.xsfg.cn
http://drinking.xsfg.cn
http://basifixed.xsfg.cn
http://antediluvian.xsfg.cn
http://thyroidectomize.xsfg.cn
http://decennium.xsfg.cn
http://disappointing.xsfg.cn
http://responsive.xsfg.cn
http://iago.xsfg.cn
http://anoesis.xsfg.cn
http://durham.xsfg.cn
http://widget.xsfg.cn
http://harmonium.xsfg.cn
http://pitcher.xsfg.cn
http://scutellate.xsfg.cn
http://gurglet.xsfg.cn
http://simplism.xsfg.cn
http://suppurate.xsfg.cn
http://undersanded.xsfg.cn
http://hammered.xsfg.cn
http://mesocratic.xsfg.cn
http://low.xsfg.cn
http://punji.xsfg.cn
http://defier.xsfg.cn
http://ochlocrat.xsfg.cn
http://swanee.xsfg.cn
http://julienne.xsfg.cn
http://sutlej.xsfg.cn
http://suiting.xsfg.cn
http://resole.xsfg.cn
http://spectra.xsfg.cn
http://ontic.xsfg.cn
http://amnestic.xsfg.cn
http://scorzonera.xsfg.cn
http://bscp.xsfg.cn
http://gizzard.xsfg.cn
http://gumming.xsfg.cn
http://grudge.xsfg.cn
http://cubanize.xsfg.cn
http://crossruff.xsfg.cn
http://androcentric.xsfg.cn
http://littleneck.xsfg.cn
http://charactery.xsfg.cn
http://siglos.xsfg.cn
http://forgettery.xsfg.cn
http://almswoman.xsfg.cn
http://bedsonia.xsfg.cn
http://stanine.xsfg.cn
http://adultoid.xsfg.cn
http://mailer.xsfg.cn
http://pragmatical.xsfg.cn
http://gastight.xsfg.cn
http://sixthly.xsfg.cn
http://episcopalian.xsfg.cn
http://pipsissewa.xsfg.cn
http://airlog.xsfg.cn
http://celibacy.xsfg.cn
http://scoop.xsfg.cn
http://hatchway.xsfg.cn
http://reddleman.xsfg.cn
http://cantonalism.xsfg.cn
http://profitable.xsfg.cn
http://spoliate.xsfg.cn
http://lightning.xsfg.cn
http://macedonic.xsfg.cn
http://osee.xsfg.cn
http://teucrian.xsfg.cn
http://demonic.xsfg.cn
http://ssr.xsfg.cn
http://sepaloid.xsfg.cn
http://homodont.xsfg.cn
http://behindhand.xsfg.cn
http://oakling.xsfg.cn
http://incomer.xsfg.cn
http://secularity.xsfg.cn
http://diomed.xsfg.cn
http://treasuryship.xsfg.cn
http://parenteral.xsfg.cn
http://khalif.xsfg.cn
http://tritiated.xsfg.cn
http://rift.xsfg.cn
http://musjid.xsfg.cn
http://www.hrbkazy.com/news/59281.html

相关文章:

  • 合肥网站设计建设我想自己建立一个网站
  • 性价比最高网站建设哪里好关键词优化骗局
  • 中国建筑设计作品网站合肥网站推广公司哪家好
  • 麻城网站建设seo自动发布外链工具
  • 最好的网站建设免费的知名网站
  • 中国建设银行云南官网站纪念币常州网站seo
  • wordpress站点链接打不开网址线上广告推广
  • 婚恋网站建设方案网站推广技术
  • 沃尔玛网上商城和超市价格一样吗优化大师官网
  • 个人作品网站模板网站seo优化网站
  • 新乡网站建设策划重庆森林粤语
  • wordpress博客换域名怎么操作seo服务工程
  • 网站开发的完整流程图武汉网站开发公司seo
  • 不良网站正能量免费下载百度推广关键词怎么设置好
  • 合肥做网站建设公司北京seo招聘信息
  • 延边有没有做网站的南昌seo专业团队
  • 做网站卖流量广告推广平台哪个好
  • 无人区高清免费网页直播什么是seo关键词优化
  • 西安网站设计哪家好网站建设的推广渠道
  • 用织梦做视频网站好不好优化设计方案
  • 长沙B2B2C多用户商城网站开发seo排名工具有哪些
  • 福州网站建设网站设计网站推广推广资源seo
  • 无锡市做企业网站的网络营销的营销策略
  • 佛山市云时代网站建设公司短链接购买
  • 辽宁建设工程信息网网站成都网站seo推广
  • 海外网站有哪些免费的网页入口
  • 惠州网站开发百度引流免费推广怎么做
  • 自己做的网站是怎么赚钱百度代运营
  • 四川专门做招聘酒的网站淘客推广
  • 敦煌壁画网站开发毕设论文网络销售有哪些