当前位置:网站首页>【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)情况不多见并且只要节点个数不多,不会对性能造成影响。
边栏推荐
- 移动端 1px 像素兼容性问题,实现1px 边框
- 实现BottomNavigationView和Navigation联动
- AES高级加密协议的动机阐述
- 设置单击右键可以选择用VS Code打开文件
- 编辑卡顿
- Freshman learning sharing
- Deep analysis of data storage in memory - C language
- 情感对话识别与生成简述
- RecyclerView结合ViewBinding的使用
- 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

Chow-Liu Tree

4 special cases! Schools in area a adopt the re examination score line in area B!

设置单击右键可以选择用VS Code打开文件

PMP project integration management
![[NPUCTF2020]ezlogin xPATH注入](/img/6e/dac4dfa0970829775084bada740542.png)
[NPUCTF2020]ezlogin xPATH注入

WebRTC音视频采集和播放示例及MediaStream媒体流解析

从底层结构开始学习FPGA----Xilinx ROM IP的定制与测试

Redis expiration policy +conf record

海思 VI接入视频流程
随机推荐
Chow-Liu Tree
Doorplate making C language
C#中Linq用法汇集
Construction of Hisilicon 3559 universal platform: rotation operation on the captured YUV image
Solving ordinary differential equations with MATLAB
Niuke network: maximum submatrix
Jerry's built-in shutdown current is 1.2ua, and then it can't be turned on by long pressing [chapter]
The first batch of Tencent cloud completed the first cloud native security maturity assessment in China
The motivation of AES Advanced Encryption Protocol
情感对话识别与生成简述
Cryptographic technology -- key and ssl/tls
泛型与反射,看这篇就够了
移动端 1px 像素兼容性问题,实现1px 边框
Tronapi-波场接口-源码无加密-可二开--附接口文档-基于ThinkPHP5封装-作者详细指导-2022年7月1日08:43:06
P1007 single log bridge
PotPlayer设置最小化的快捷键
Use the scroll bar of souI when using the real window in souI
Jerry's built-in short press and long press, no matter how long it is, it is a short press [chapter]
Go multithreaded data search
Looking at Ctrip's toughness and vision from the Q1 financial report in 2022