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

网站名称如何设置林州建筑网

网站名称如何设置,林州建筑网,网站文章内容优化方案,引流网站建设教程redis 存储在内存中 key-value存储 主要存储热点数据(短时间大量的访客去访问) 启动命令 redis-server.exe redis.windows.conf 客户端链接redis服务器 redis-cli.exe redis-cli.exe -h localhost -p 6379 redis-cli.exe -h localhost -p 6379 -a 123456 退出 exit 命令不区分…

redis 存储在内存中 key-value存储 主要存储热点数据(短时间大量的访客去访问)
启动命令
redis-server.exe redis.windows.conf
客户端链接redis服务器
redis-cli.exe
redis-cli.exe -h localhost -p 6379
redis-cli.exe -h localhost -p 6379 -a 123456
退出
exit

命令不区分大小写

一、字符串

在这里插入图片描述

二、哈希操作

在这里插入图片描述

三、列表操作

在这里插入图片描述

四、集合操作

在这里插入图片描述

五、有序集合

在这里插入图片描述

六、通用命令

在这里插入图片描述
keys *

七、在Java中操作Redis

7.1、Spring Data Redis

在这里插入图片描述
在这里插入图片描述

        //string数据操作ValueOperations valueOperations = redisTemplate.opsForValue();//hash类型的数据操作HashOperations hashOperations = redisTemplate.opsForHash();//list类型的数据操作ListOperations listOperations = redisTemplate.opsForList();//set类型数据操作SetOperations setOperations = redisTemplate.opsForSet();//zset类型数据操作ZSetOperations zSetOperations = redisTemplate.opsForZSet();
	/*** 操作字符串类型的数据*/@Testpublic void testString(){// set get setex setnxredisTemplate.opsForValue().set("name","小明");String city = (String) redisTemplate.opsForValue().get("name");System.out.println(city);redisTemplate.opsForValue().set("code","1234",3, TimeUnit.MINUTES);redisTemplate.opsForValue().setIfAbsent("lock","1");redisTemplate.opsForValue().setIfAbsent("lock","2");}
	/*** 操作哈希类型的数据*/@Testpublic void testHash(){//hset hget hdel hkeys hvalsHashOperations hashOperations = redisTemplate.opsForHash();hashOperations.put("100","name","tom");hashOperations.put("100","age","20");String name = (String) hashOperations.get("100", "name");System.out.println(name);Set keys = hashOperations.keys("100");System.out.println(keys);List values = hashOperations.values("100");System.out.println(values);hashOperations.delete("100","age");}
	/*** 操作列表类型的数据*/@Testpublic void testList(){//lpush lrange rpop llenListOperations listOperations = redisTemplate.opsForList();listOperations.leftPushAll("mylist","a","b","c");listOperations.leftPush("mylist","d");List mylist = listOperations.range("mylist", 0, -1);System.out.println(mylist);listOperations.rightPop("mylist");Long size = listOperations.size("mylist");System.out.println(size);}
	/*** 操作集合类型的数据*/@Testpublic void testSet(){//sadd smembers scard sinter sunion sremSetOperations setOperations = redisTemplate.opsForSet();setOperations.add("set1","a","b","c","d");setOperations.add("set2","a","b","x","y");Set members = setOperations.members("set1");System.out.println(members);Long size = setOperations.size("set1");System.out.println(size);Set intersect = setOperations.intersect("set1", "set2");System.out.println(intersect);Set union = setOperations.union("set1", "set2");System.out.println(union);setOperations.remove("set1","a","b");}
	/*** 操作有序集合类型的数据*/@Testpublic void testZset(){//zadd zrange zincrby zremZSetOperations zSetOperations = redisTemplate.opsForZSet();zSetOperations.add("zset1","a",10);zSetOperations.add("zset1","b",12);zSetOperations.add("zset1","c",9);Set zset1 = zSetOperations.range("zset1", 0, -1);System.out.println(zset1);zSetOperations.incrementScore("zset1","c",10);zSetOperations.remove("zset1","a","b");}
	/*** 通用命令操作*/@Testpublic void testCommon(){//keys exists type delSet keys = redisTemplate.keys("*");System.out.println(keys);Boolean name = redisTemplate.hasKey("name");Boolean set1 = redisTemplate.hasKey("set1");for (Object key : keys) {DataType type = redisTemplate.type(key);System.out.println(type.name());}redisTemplate.delete("mylist");}
http://www.yayakq.cn/news/800708/

相关文章:

  • 做网站如何避免侵权wordpress 跳转 微信
  • 电子商务网站开发与设计百度推广要企业自己做网站吗
  • 模板手机网站建设宝宝投票网站怎么做
  • 乔拓云建站平台网页设计与制作考试
  • 学校网站建设开题报告书公司做网站宣传怎么做
  • 一般的网站开发语言用什么百度高级搜索页面
  • 上海企业建站工具常用网站如何在桌面做快捷方式
  • 网站建设与百度推广种子搜索器
  • 做购物商城网站设计参考文献 教学网站建设
  • 建设银行手机短信网站怎么开通怎么免费建立网店网站
  • 网站制作方案在哪找企业网站开发模板
  • 如何做网站直播入口搭建跨境电商平台
  • 镇江网站制作公司重庆商城网站建设地址
  • 外贸网站谷歌推广手机app软件开发需要多少钱
  • 江西天亿建设有限公司网站如何建设自己企业网站
  • 导航网站 wordpress做公益网站怎么赚钱
  • 贵州省住房和城乡建设厅网站打不开太仓网站优化
  • 怎么知道自己网站的权重iis创建网站
  • 站长工具端口扫描视频当背景图片 网站开发
  • 做网站的知识京津冀协同发展心得体会
  • 一一影视网站源码网站建设质量保证
  • 网站建设策划方案pptwordpress做商城网站吗
  • 宁夏建设工程招投标管理中心网站武夷山网站定制
  • 新乡做网站推广手机网站菜单
  • 学做网站在什么地方学石家庄seo网络推广
  • 域名网站备案资源最多的磁力搜索引擎
  • 有专门学做衣服网站菠菜网站怎么建设
  • 济南网站建设公司按需定制微营销工具有哪些
  • 做公司网站需不需要注册滨州做网站的科技公司
  • 苏州市建设局网站集群统一登录安徽省建设厅网站职称