当前位置:网站首页>Redis (VI) - list of common data types of redis
Redis (VI) - list of common data types of redis
2022-04-22 13:42:00 【Mainong Feige】
Hello! , I'm Manon Feige , Thank you for reading this article , Welcome to three links with one button .
1. Python Basic column , Basic knowledge in a net ,9.9 Yuan can't buy a loss , I can't buy it . Python From entry to mastery
️ 2. Python Crawler column , Systematically learn the knowledge points of reptiles .9.9 Yuan can't buy a loss , I can't buy it , Ongoing update .python Reptile beginner level
️ 3. Ceph actual combat , Everything from principle to actual combat . Ceph actual combat
️ 4. Java Introduction to high concurrency programming , Punch in to learn Java High concurrency . Java Introduction to high concurrency programming
5. Take a stroll around the community , Weekly benefits , There are surprises every week . Manon Feige community , Leap plan
The whole network has the same name 【 Manon Feige 】 Welcome to your attention , personal VX: wei158556
List of articles
brief introduction
Redis The list in is a simple list of strings , You can add an element to the head of the list ( On the left ) Or tail ( On the right ), You can use it to make a microblog timeline list , It can also act as a queue
Common commands
- From the left / Insert one or more values... To the right
# Insert... From the left
lpush <key1> <value1> <value2> ......
# Insert... From the right
rpush <key1> <value1> <value2> ......
- From the left / Spit out a value on the right , Take out a value and delete it , Value at key at , Value dead key dead .
# Spit it out on the left
lpop <key1>
# Spit it out from the right
rpop <key1>



As can be seen from the above examples , Insert from the left and spit out from the left , That is the form of first in and last out , If you insert from the left and spit out from the right, that's the form of first in first out .
- from
<key1>Spit a value on the right side of the list , insert<key2>To the left of the list
rpoplpush <key1> <key2>
- Get elements according to index subscript ( From left to right ), among
<start>by 0 Time refers to the first one on the left ,<stop>by -1 Time refers to the first one on the right ,(0~-1 To get all )
lrange <key> <start> <stop>

- Get elements according to index subscript ( From left to right )
lindex <key> <index>
- Get the list length
llen <key>

- stay
<value>In front of | Insert... At the back<newvalue>Insert value
# stay `<value>` Insert in front of `<newvalue>` Insert value
linsert <key> before <value> <newvalue>
#`<value>` Insert after `<newvalue>` Insert value
linsert <key> after <value> <newvalue>

- from
<value>Delete... On the left of n individual<value>( From left to right )
lrem <key1> <n> <value>

- Will list
<key>Subscript to be<index>Replace the value of with<value>
lset <key> <index> <value>

data structure
List The data structure of is fast linked list quickList.
In the case of fewer list elements, use a continuous memory storage , This structure is ziplist, That is, compress the list .
It stores all the elements next to each other , Allocated is a continuous block of memory .
When there is a large amount of data, it will be changed to quickList.
Because ordinary linked list needs too much additional pointer space , It's a waste of space , For example, what is stored in this list is int Type data , Structure Shanghai requires two additional pointers prev and next.

Redis Linking lists and ziplist Combined to form quicklist. That is to say, multiple ziplist Use two-way pointer string to use . This not only satisfies the fast insertion and deletion performance , There will not be too much space redundancy .
For details, you can learn about this article Redis( 7、 ... and )-Redis Of list The data structure of the list - Quick list
Reference resources
《Redis Design and implementation 》
Redis Basic types and their data structures
版权声明
本文为[Mainong Feige]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221339148765.html
边栏推荐
- 说了栈和队列的区别以后,面试官当场就吐了,同学们千万要引以为戒。
- 快速串讲校招高频面试题——排序算法和复杂度
- Walking in the clouds - but there are books
- Model based RL overview
- Share the five cases of websites slowing down recently
- 【Flutter 专题】91 图解 Dart 单线程实现异步处理之 Future (二) #yyds干货盘点#
- 思皓X6安全配置信息曝光 将搭载自适应巡航
- 数字孪生:如何撑起一个万亿市场的产业变革?
- How to perform multi table associated query on Citrix SQL data
- 5分钟快速了解MySQL索引的各种类型
猜你喜欢

各省GTFP綠色全要素生產率面板數據(2004-2018年)

no main manifest attribute / . There is no main manifest attribute in jar

11 standard library of in-depth C language and program operation principle: in-depth understanding of standard IO (learning notes)

高管团队异质性和稳定性数据(含代码、计算过程及原始数据)

FreeRTOS快速入门-初探FreeRTOS

Citrix SQL数据如何进行多表联查

中英文会计&金融情绪词典

分省创新能力面板数据 - 含专利数、成交额等多指标数据(2008-2019年)

指定Swagger接口文档中参数序列化组件为Newtonsoft.Json

The "open source summer" activity is hot. In the registration, rich bonuses are waiting for you to get
随机推荐
XML external entity attack principle and Practice (xxE) (1)
Is the account opening of Guoyuan futures company reliable? Is the transaction safe?
【计量经济学】统计推断
华为云媒体査勇:华为云在视频AI转码领域的技术实践
从月薪10k到30k的必走之路:自动化测试
Knowledge to be learned
500 Internal Server Error supplement
待学习知识
no main manifest attribute / . There is no main manifest attribute in jar
Add pyrcc5 to pychar's external tool
各省GTFP绿色全要素生产率面板数据(2004-2018年)
Panel data of provincial innovation capacity - including multi index data such as number of patents and turnover (2008-2019)
11 standard library of in-depth C language and program operation principle: in-depth understanding of standard IO (learning notes)
Model based RL overview
The "open source summer" activity is hot. In the registration, rich bonuses are waiting for you to get
[software test series x] stress test scheme
将pyrcc5添加到Pycharm的外部工具
After talking about the difference between stack and queue, the interviewer threw up on the spot. Students should take warning.
Xen thermal repair technology (basic understanding)
分享下最近遇到的5种网站变慢的案例