当前位置:网站首页>Redis list
Redis list
2022-07-06 01:40:00 【Freezing point contract】
Redis list (List)
Introduce
- Single bond multi value
- Redis List is a simple list of strings , Sort by insertion order . You can add an element to the head of the list ( On the left ) Or tail ( On the right )
- Its bottom layer is actually a two-way linked list , High performance on both ends , The performance of the nodes in the middle of the index subscript operation will be poor
Common commands
Insert one or more values from the left
lpush <key> <value1> <value2> ...Insert one or more values from the right
rpush <key> <value1> <value2> ...Pop up a value from the left ( The value will be deleted )
lpop <key>Pop up a value from the right ( The value will be deleted )
rpop <key>From the list key1 A value pops up on the right and is inserted into key2 On the left
rpoplpush <key1> <key2>Get elements in batches according to the index (-1 Represents the last element )
lrange <key> <start> <stop>Get a single element according to the index ( From left to right )
lindex <key> <index>Get list length
llen <key>stay value Insert element before target
linsert <key> before <value> <target>Delete from the left n The values are value The elements of
lrem <key> <n> <value>Index the list as index Replace the value of with value
lset <key> <index> <value>
The underlying data structure of the list

- List The data structure of is fast linked list quickList
- First, in the case of fewer list elements will use a block of continuous memory storage , This structure is ziplist, That is, compressed list ( It's like a sequence table ), 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's in this list is just int Data of type , Two additional pointers are required for the structure 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
边栏推荐
- A picture to understand! Why did the school teach you coding but still not
- C web page open WinForm exe
- Accelerating spark data access with alluxio in kubernetes
- General operation method of spot Silver
- NiO related knowledge (II)
- 2022年广西自治区中职组“网络空间安全”赛题及赛题解析(超详细)
- 037 PHP login, registration, message, personal Center Design
- SPIR-V初窺
- [detailed] several ways to quickly realize object mapping
- Ali test open-ended questions
猜你喜欢
随机推荐
LeetCode 322. Change exchange (dynamic planning)
Ali test open-ended questions
Paddle框架:PaddleNLP概述【飛槳自然語言處理開發庫】
Selenium waiting mode
You are using pip version 21.1.1; however, version 22.0.3 is available. You should consider upgradin
Accelerating spark data access with alluxio in kubernetes
[le plus complet du réseau] | interprétation complète de MySQL explicite
3D model format summary
UE4 unreal engine, editor basic application, usage skills (IV)
NumPy 数组索引 切片
Netease smart enterprises enter the market against the trend, and there is a new possibility for game industrialization
剑指 Offer 12. 矩阵中的路径
【Flask】官方教程(Tutorial)-part1:项目布局、应用程序设置、定义和访问数据库
Mongodb problem set
Basic operations of databases and tables ----- unique constraints
Unity VR resource flash surface in scene
Basic operations of database and table ----- set the fields of the table to be automatically added
干货!通过软硬件协同设计加速稀疏神经网络
Remember that a version of @nestjs/typeorm^8.1.4 cannot be obtained Env option problem
Numpy array index slice


![[技术发展-28]:信息通信网大全、新的技术形态、信息通信行业高质量发展概览](/img/94/05b2ff62a8a11340cc94c69645db73.png)






