当前位置:网站首页>Redis类型
Redis类型
2022-07-28 04:39:00 【程程呀是小白】
目录

本文是本人以前笔记,如果说是在掘金上看到的话没错,还是本人程程呀 的个人主页 - 文章 - 掘金 只有这一个。如果有哪里不对的话欢迎各位大佬指出问题,本人是一个小白。
上一篇文章链接为:Redis6_程程呀是小白的博客-CSDN博客 ,本篇是连接上一篇文章Redis6_程程呀是小白的博客-CSDN博客 的。
如果是springboot的话请看springboot创建项目_程程呀是小白的博客-CSDN博客 ,这个是从头开始的还没有学完springboot,一起学习呀!!!!
Redis类型
1 String(字符串):
APPEND key:追加字符串,如果当前key不存在,就相当于setkey
STRLEN key:获取字符串长度
步长:set views 初始值为0
incr views :自增1
Decr views :自减1
INCRBY views 10:可以设置步长,指定增量
DECRBY views5:可以设置步长,指定减量
字符串范围range:
GETRANGE key1 0 3(截取字符串0到3)
替换: SETRANGE key2 1 xx(替换指定位置开始的字符串)
Setex :设置过期时间
Setnx :不存在在设置。没有就创建,有提示创建失败
Mset : 同时设置多个值
Mget :同时获取多个值
Msetnx :是一个原子性的操作,要么一起成功,要么一起失败
Getset :先get再set 如果不存在,则返回nil;如果存在获取原来的值并设置新的值
Getrange<起始位置><结束位置>
Setrange<起始位置>
2 List
Lpush/rpush ...从左边/右边插入一个或多个值
Lpop/rpop从左边/右边吐出一个值。值在键在,值光键亡
Rpoplush从key1列表右边吐出一个值,插入到key2列表左边
Lrange按照索引获得元素(从左到右)
Lindex按照索引获取元素
Llen获取列表长度
Linsertbefore 在value后面插入newvalue插入值
Lrem从左边删除n个value(从左到右)
Lset将key下标为index的值替换为value
3 Set
Sadd 将一个或者多个value添加到key中,已经存在的忽略
Smembers取出key的值
Sismember判断集合key是否含有value值
Srem... 删除集合中某个元素
Scard返回集合个数
Srem随机吐出一个值
Srandmember随机吐出n个值不会删除
Smovevalue把集合中的值从一个集合移动到另一个
Sinter返回两个集合的交集元素
Sunion返回两个集合的并集元素
Sdiff返回两个集合的差集元素(key1中的,不包括key2的)
4 hash
Hset给key中的filed键赋值value
Hget从key中field取出value
Hmset...批量设置hash值
Hexists查看哈希表中key中,给定义域field是否存在
Hkeys列出该hash集合所有field
Hvals列出该hash集合的所有value
Hincrby为哈希表key中的域filed的值增量
Hsetnx将哈希表key中的field的值设置为value。并且仅当域field不存在
5有序集合zset
Zadd...将一个或者多个member元素及其score值加入到有序key中
Zrange[withscores]返回有序集合key中下标在start stop之间的元素带withscores,可以让方式一起返回到结果集
Zrangebyscore key minmax[withscores][limit offset count]返回有序集key中所有score值介于min和max之间的成员有序集合成员按score递增(从小到大)排序
Zrevrangebyscore key maxmin[withscores][limit offset count]从大的小
Zincrby为元素的scores加上增量
Zrem删除该集合,指定值的元素
Zcount统计该集合,分数区间内元素个数
Zrank返回该值在集合中的排名,从0开始
本文是本人以前笔记,如果说是在掘金上看到的话没错,还是本人程程呀 的个人主页 - 文章 - 掘金 只有这一个。如果有哪里不对的话欢迎各位大佬指出问题,本人是一个小白。
上一篇文章链接为:Redis6_程程呀是小白的博客-CSDN博客 ,本篇是连接上一篇文章Redis6_程程呀是小白的博客-CSDN博客 的。
如果是springboot的话请看springboot创建项目_程程呀是小白的博客-CSDN博客 ,这个是从头开始的还没有学完springboot,一起学习呀!!!!
边栏推荐
- Reading of papers on "towards generative aspect based sentimental analysis"
- [Sylar] practical part - redis based parameter query service
- 【sylar】框架篇-Chapter7-IO 协程调度模块
- Ma Yi, Shen Xiangyang, Cao Ying's latest AI overview is hot! It took 3 months to build, netizens: required papers
- CMake使用基础汇总
- 重要的 SQL Server 函数 - 数字函数
- Advanced architects, 16 common principles of microservice design and Governance
- 【sylar】框架篇-Chapter10-Address 模块
- 方舟生存进化自建服务器要多少成本?
- 上班摸鱼打卡模拟器微信小程序源码
猜你喜欢

Reading of seq2path: generating sentimental tuples as paths of a tree

Internet of things industrial serial port to WiFi module wireless routing WiFi module selection

【实战】使用 Web Animations API 实现一个精确计时的时钟

Shanghai Telecom released public computing services and signed the action plan of "Joint Innovation Center for intelligent computing applications" with Huawei and other partners

Jupyter notebook installation code prompt function

Fearless of side impact damage, Chery arize 8 fully protects the safety of passengers

高数_第4章__曲线积分_习题解法

01-Node-Express系统框架搭建(express-generator)

2022-7-27 顾宇佳 学习笔记

Elementary level of C language -- while, for, do while
随机推荐
MySQL partition table transformation
MySQL数据库————初识数据库
Information system project manager (2022) - key content: intellectual property rights and standards and specifications (22)
Reading of a unified generic framework for aspect based sentimental analysis
CMake使用基础汇总
【sylar】实战篇-基于 redis 的参数查询服务
[yolov5 practice 5] traffic sign recognition system based on yolov5 -yolov5 integration pyqt5
Full resolution of the use of go native plug-ins
Reading the paper "learning span level interactions for aspect sentimental triple extraction"
Campus stray cat information recording and sharing applet source code
Object locking in relational database transactions
21 openwrt kernel module changed to.Ko automatic loading
【sylar】框架篇-Chapter9-hook 模块
【sylar】框架篇-Chapter14-TcpServer 模块
[Sylar] framework -chapter15 stream module
Go grpc: a solution of connection reset by peer
Cmake usage base summary
【sylar】框架篇-Chapter15-Stream 模块
10 more advanced open source command line tools
Use animatedbuilder to separate components and animation, and realize dynamic reuse