当前位置:网站首页>【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)情况不多见并且只要节点个数不多,不会对性能造成影响。
边栏推荐
- 地平线2022年4月最新方案介绍
- [chestnut sugar GIS] ArcScene - how to make elevation map with height
- P1007 single log bridge
- BBR 遭遇 CUBIC
- mysql重置密码,忘记密码,重置root密码,重置mysql密码
- Tronapi-波场接口-源码无加密-可二开--附接口文档-基于ThinkPHP5封装-作者详细指导-2022年7月1日08:43:06
- 从底层结构开始学习FPGA----Xilinx ROM IP的定制与测试
- Freshman learning sharing
- 成功改变splunk 默认URL root path
- Learning Websites commonly used by circuit designers
猜你喜欢

Construction of Hisilicon 3559 universal platform: draw a frame on the captured YUV image

Configuration clic droit pour choisir d'ouvrir le fichier avec vs Code

归并排序详解及应用

Generics and reflection, this is enough

数据标注典型案例,景联文科技如何助力企业搭建数据方案

Lambda expression: an article takes you through
![P7072 [csp-j2020] live broadcast Award](/img/bc/fcbc2b1b9595a3bd31d8577aba9b8b.png)
P7072 [csp-j2020] live broadcast Award

【喜欢的诗词】好了歌

China Academy of information technology, Tsinghua University, Tencent security, cloud native security, industry university research and use strong alliance!
![[chestnut sugar GIS] how does global mapper batch produce ground contour lines through DSM](/img/5d/c23ec16df6ce8d78207b635f59dc20.png)
[chestnut sugar GIS] how does global mapper batch produce ground contour lines through DSM
随机推荐
[leetcode] most elements [169]
AES高級加密協議的動機闡述
ping域名报错unknown host,nslookup/systemd-resolve可以正常解析,ping公网地址通怎么解决?
首批 | 腾讯云完成国内首个云原生安全成熟度评估
Explain promise usage in detail
Stop slave is stuck -- the event of the transaction is not copied completely
Pytorch training CPU usage continues to grow (Bug)
Successfully changed Splunk default URL root path
Xshell configuration xforward forwarding Firefox browser
数据标注典型案例,景联文科技如何助力企业搭建数据方案
损失函数~
[npuctf2020]ezlogin XPath injection
Numerical solution of partial differential equations with MATLAB
Potplayer set minimized shortcut keys
MySQL reset password, forget password, reset root password, reset MySQL password
Niuke network: maximum submatrix
Go语言sqlx库操作SQLite3数据库增删改查
Tronapi-波场接口-源码无加密-可二开--附接口文档-基于ThinkPHP5封装-作者详细指导-2022年7月1日08:43:06
分布式监控系统zabbix
The kth largest element in the [leetcode] array [215]