当前位置:网站首页>【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 prototype has no touch, and the reinstallation becomes normal after dismantling [chapter]
- LC173. 二叉搜索树迭代器
- 力扣刷题(2022-6-28)
- `Usage of ${}`
- 容器化技术在嵌入式领域的应用
- 【喜欢的诗词】好了歌
- Qt QSplitter拆分器
- 1px pixel compatibility of mobile terminal, 1px border
- The first batch of Tencent cloud completed the first cloud native security maturity assessment in China
- Qt QScrollArea
猜你喜欢
随机推荐
Learning Websites commonly used by circuit designers
Go语言sqlx库操作SQLite3数据库增删改查
Chow-Liu Tree
2016. 增量元素之间的最大差值
用matlab调用vs2015来编译vs工程
mysql重置密码,忘记密码,重置root密码,重置mysql密码
Doorplate making C language
Construction of Hisilicon 3559 universal platform: draw a frame on the captured YUV image
Easyclick, EC Quanlang network verification source code
Qt QScrollArea
[leetcode] number of palindromes [9]
Ping domain name error unknown host, NSLOOKUP / system d-resolve can be resolved normally, how to Ping the public network address?
分布式监控系统zabbix
Potplayer set minimized shortcut keys
Motivation du Protocole de chiffrement avancé AES
Xshell configuration xforward forwarding Firefox browser
Methods to solve the tampering of Chrome browser and edeg browser homepage
Analyse des données dossiers d'apprentissage - - analyse simple de la variance à facteur unique avec Excel
xshell配置xforward转发火狐浏览器
Deep analysis of data storage in memory - C language



![[leetcode] reverse the word III in the string [557]](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)




![[Solved] Splunk: Cannot get username when all users are selected“](/img/13/1e824c8005701e21fc5b4e73308d53.png)