当前位置:网站首页>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
边栏推荐
- 一图看懂!为什么学校教了你Coding但还是不会的原因...
- Luo Gu P1170 Bugs Bunny and Hunter
- 【Flask】响应、session与Message Flashing
- Basic operations of databases and tables ----- non empty constraints
- Huawei Hrbrid interface and VLAN division based on IP
- [flask] official tutorial -part2: Blueprint - view, template, static file
- leetcode刷题_反转字符串中的元音字母
- yii中console方法调用,yii console定时任务
- National intangible cultural heritage inheritor HD Wang's shadow digital collection of "Four Beauties" made an amazing debut!
- 【已解决】如何生成漂亮的静态文档说明页
猜你喜欢

Superfluid_ HQ hacked analysis

3D model format summary

Open source | Ctrip ticket BDD UI testing framework flybirds

Basic operations of databases and tables ----- primary key constraints

MUX VLAN configuration
Folio.ink 免费、快速、易用的图片分享工具

普通人下场全球贸易,新一轮结构性机会浮出水面

MATLB|实时机会约束决策及其在电力系统中的应用

Accelerating spark data access with alluxio in kubernetes

MySQL learning notes 2
随机推荐
Netease smart enterprises enter the market against the trend, and there is a new possibility for game industrialization
UE4 unreal engine, editor basic application, usage skills (IV)
Leetcode skimming questions_ Verify palindrome string II
插卡4G工业路由器充电桩智能柜专网视频监控4G转以太网转WiFi有线网速测试 软硬件定制
Basic operations of database and table ----- delete data table
[the most complete in the whole network] |mysql explain full interpretation
Paddle framework: paddlenlp overview [propeller natural language processing development library]
Basic operations of databases and tables ----- unique constraints
Unity VR solves the problem that the handle ray keeps flashing after touching the button of the UI
Luo Gu P1170 Bugs Bunny and Hunter
How to see the K-line chart of gold price trend?
How to get the PHP version- How to get the PHP Version?
3D vision - 4 Getting started with gesture recognition - using mediapipe includes single frame and real time video
SPIR-V初窥
A Cooperative Approach to Particle Swarm Optimization
How does the crystal oscillator vibrate?
NLP fourth paradigm: overview of prompt [pre train, prompt, predict] [Liu Pengfei]
[Yu Yue education] Liaoning Vocational College of Architecture Web server application development reference
Ali test open-ended questions
Huawei Hrbrid interface and VLAN division based on IP