当前位置:网站首页>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
边栏推荐
- Alibaba-Canal使用详解(排坑版)_MySQL与ES数据同步
- 竞价推广流程
- Format code_ What does formatting code mean
- 500 lines of code to understand the principle of mecached cache client driver
- SPIR-V初窺
- Huawei converged VLAN principle and configuration
- [solved] how to generate a beautiful static document description page
- ctf. Show PHP feature (89~110)
- [detailed] several ways to quickly realize object mapping
- 2022年广西自治区中职组“网络空间安全”赛题及赛题解析(超详细)
猜你喜欢

NumPy 数组索引 切片
Folio. Ink is a free, fast and easy-to-use image sharing tool

UE4 unreal engine, editor basic application, usage skills (IV)

How does the crystal oscillator vibrate?

【SSRF-01】服务器端请求伪造漏洞原理及利用实例

Une image! Pourquoi l'école t'a - t - elle appris à coder, mais pourquoi pas...
![[technology development -28]: overview of information and communication network, new technology forms, high-quality development of information and communication industry](/img/94/05b2ff62a8a11340cc94c69645db73.png)
[technology development -28]: overview of information and communication network, new technology forms, high-quality development of information and communication industry

Basic operations of database and table ----- set the fields of the table to be automatically added

Basic operations of databases and tables ----- default constraints

A picture to understand! Why did the school teach you coding but still not
随机推荐
[技术发展-28]:信息通信网大全、新的技术形态、信息通信行业高质量发展概览
A Cooperative Approach to Particle Swarm Optimization
MATLB|实时机会约束决策及其在电力系统中的应用
How does Huawei enable debug and how to make an image port
国家级非遗传承人高清旺《四大美人》皮影数字藏品惊艳亮相!
PHP error what is an error?
[flask] official tutorial -part1: project layout, application settings, definition and database access
NLP fourth paradigm: overview of prompt [pre train, prompt, predict] [Liu Pengfei]
internship:项目代码所涉及陌生注解及其作用
Accelerating spark data access with alluxio in kubernetes
Dynamics 365 开发协作最佳实践思考
leetcode刷题_平方数之和
Alibaba-Canal使用详解(排坑版)_MySQL与ES数据同步
[flask] response, session and message flashing
一圖看懂!為什麼學校教了你Coding但還是不會的原因...
Kubernetes stateless application expansion and contraction capacity
Ali test open-ended questions
c#网页打开winform exe
How to get all sequences in Oracle database- How can I get all sequences in an Oracle database?
Poj2315 football games