当前位置:网站首页>【Redis笔记】压缩列表(ziplist)
【Redis笔记】压缩列表(ziplist)
2022-07-02 22:10:00 【暮色_年华】
压缩列表的定义:
压缩列表是为了节约内存而开发的,是由一系列特殊编码的连续内存块组成的顺序型数据结构。
压缩列表的构成:
压缩列表节点的构成:
previous_entry_length:记录压缩列表前一个节点的长度
根据previous_entry_length,程序可以通过指针运算,根据当前节点的起始地址来计算出前一个节点的起始地址,从而实现从表尾到表头遍历。
encoding:
记录节点的content属性保存的数据的类型和长度
content:
负责保存节点的值,节点值可以是一个字节数组或者整数,值的类型和长度由节点的encoding属性决定。
连锁更新:
添加或删除节点,如果长度大于254字节,可能导致后一个节点的previous_entry_length大小需要从1字节变为5字节,这样可能会导致后续节点的previous_entry_length都发生变化,在这种情况下,需要进行连续多次空间拓展操作。
说明:
(1)空间分配最坏时间复杂度O(N),连锁更新的最坏时间复杂度O(N方)
(2)情况不多见并且只要节点个数不多,不会对性能造成影响。
边栏推荐
- Jerry's charge unplugged, unable to touch the boot [chapter]
- MySQL查询附近的数据.并按距离进行排序.
- LeetCode 968. Monitor binary tree
- P7072 [csp-j2020] live broadcast Award
- 分布式监控系统zabbix
- 地平线2022年4月最新方案介绍
- Solving ordinary differential equations with MATLAB
- Value sequence < detailed explanation of daily question >
- 在SOUI里使用真窗口时使用SOUI的滚动条
- Redis 过期策略+conf 记录
猜你喜欢
BBR 遭遇 CUBIC
[Solved] Splunk: Cannot get username when all users are selected“
Prometheus deployment
Typical case of data annotation: how does jinglianwen technology help enterprises build data solutions
Mask R-CNN
ServletContext learning diary 1
QT qpprogressbar details
Minimum spanning tree
Start from the bottom structure to learn the customization and testing of FPGA --- Xilinx ROM IP
损失函数~
随机推荐
[favorite poems] OK, song
MySQL queries nearby data And sort by distance
[leetcode] most elements [169]
为什么RTOS系统要使用MPU?
数据标注典型案例,景联文科技如何助力企业搭建数据方案
How does Jerry test the wrong touch rate of keys [chapter]
China Academy of information technology, Tsinghua University, Tencent security, cloud native security, industry university research and use strong alliance!
[leetcode] there are duplicate elements [217]
Strictly abide by the construction period and ensure the quality, this AI data annotation company has done it!
Jinglianwen technology's low price strategy helps AI enterprises reduce model training costs
海思 VI接入视频流程
[hardware] origin of standard resistance value
海思3559万能平台搭建:在截获的YUV图像上画框
Splunk audit setting
[npuctf2020]ezlogin XPath injection
2016. maximum difference between incremental elements
成功改变splunk 默认URL root path
WebRTC音视频采集和播放示例及MediaStream媒体流解析
Niuke network: maximum submatrix
解决Chrome浏览器和Edeg浏览器主页被篡改的方法