当前位置:网站首页>[redis notes] compressed list (ziplist)
[redis notes] compressed list (ziplist)
2022-07-02 23:11:00 【Twilight_ years】
Definition of compressed list :
Compressed lists are developed to save memory , It is a sequential data structure composed of a series of special coded continuous memory blocks .
Structure of compressed list :
Structure of compressed list nodes :
previous_entry_length: Record the length of the previous node in the compressed list
according to previous_entry_length, The program can operate by pointer , Calculate the starting address of the previous node according to the starting address of the current node , So as to realize traversal from the end of the table to the header .
encoding:
Record node's content The type and length of data saved by attributes
content:
Responsible for saving the value of the node , The node value can be an array of bytes or an integer , The type and length of the value are determined by the encoding Attribute decision .
Chain update :
Add or remove nodes , If the length is greater than 254 byte , It may lead to previous_entry_length Size needs to be from 1 Bytes changed to 5 byte , This may cause subsequent nodes previous_entry_length Everything has changed , under these circumstances , Continuous space expansion operations are required .
explain :
(1) The worst time complexity of space allocation O(N), The worst time complexity of chain update O(N Fang )
(2) The situation is rare and as long as the number of nodes is small , No impact on performance .
边栏推荐
猜你喜欢
Qt QSplitter拆分器
Introduction to the latest plan of horizon in April 2022
Alibaba cloud award winning experience: how to use polardb-x
Analyse des données dossiers d'apprentissage - - analyse simple de la variance à facteur unique avec Excel
Mask R-CNN
FOC矢量控制及BLDC控制中的端电压、相电压、线电压等概念别还傻傻分不清楚
MySQL查询附近的数据.并按距离进行排序.
详解Promise使用
数据标注典型案例,景联文科技如何助力企业搭建数据方案
Is 408 not fragrant? The number of universities taking the 408 examination this year has basically not increased!
随机推荐
Potplayer set minimized shortcut keys
Jerry's built-in short press and long press, no matter how long it is, it is a short press [chapter]
阿里云有奖体验:如何使用 PolarDB-X
Webrtc audio and video capture and playback examples and mediastream media stream analysis
Brief introduction of emotional dialogue recognition and generation
設置單擊右鍵可以選擇用VS Code打開文件
Construction of Hisilicon 3559 universal platform: rotation operation on the captured YUV image
Antd component upload uploads xlsx files and reads the contents of the files
MySQL queries nearby data And sort by distance
Qt QScrollArea
Lambda表达式:一篇文章带你通透
抖音实战~点赞数量弹框
【硬件】标准阻值的由来
程序员版本的八荣八耻~
实现BottomNavigationView和Navigation联动
Strictly abide by the construction period and ensure the quality, this AI data annotation company has done it!
Mask R-CNN
Odoo13 build a hospital HRP environment (detailed steps)
泛型与反射,看这篇就够了
深度剖析数据在内存中的存储----C语言篇