当前位置:网站首页>【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)情况不多见并且只要节点个数不多,不会对性能造成影响。
边栏推荐
猜你喜欢
![Jielizhi, production line assembly link [chapter]](/img/0d/102596ad13aafd9c6133509d9064dd.png)
Jielizhi, production line assembly link [chapter]

Data analysis learning records -- complete a simple one-way ANOVA with Excel

Mask R-CNN

PMP project integration management

Jinglianwen technology's low price strategy helps AI enterprises reduce model training costs

首批 | 腾讯云完成国内首个云原生安全成熟度评估

RecyclerView结合ViewBinding的使用

MySQL查询附近的数据.并按距离进行排序.

聊聊内存模型与内存序

Generics and reflection, this is enough
随机推荐
MySQL reset password, forget password, reset root password, reset MySQL password
密码技术---分组密码的模式
4 special cases! Schools in area a adopt the re examination score line in area B!
情感对话识别与生成简述
LeetCode 968. Monitor binary tree
LC173. 二叉搜索树迭代器
How does Jerry test the wrong touch rate of keys [chapter]
Uniapp wechat login returns user name and Avatar
AES高级加密协议的动机阐述
[chestnut sugar GIS] ArcScene - how to make elevation map with height
Static file display problem
编辑卡顿
[leetcode] there are duplicate elements [217]
地平线2022年4月最新方案介绍
移动端 1px 像素兼容性问题,实现1px 边框
门牌制作 C语言
Configuration clic droit pour choisir d'ouvrir le fichier avec vs Code
[leetcode] number of palindromes [9]
The first batch of Tencent cloud completed the first cloud native security maturity assessment in China
ping域名报错unknown host,nslookup/systemd-resolve可以正常解析,ping公网地址通怎么解决?