当前位置:网站首页>Redis underlying data structure ----quicklist
Redis underlying data structure ----quicklist
2022-06-13 07:33:00 【A hard-working dog】
quickList Introduce
stay redis3.0 before ,List The underlying data structure of an object is Double linked list perhaps Compress the list stay 3.2 When ,List The bottom layer of the object is changed to quicklist Data structure implementation .
quickList Linked list is Double linked list + Compress the list Combine ,quicklist It's a linked list , The elements in the linked list are compressed lists .
quicklist Data structure of
typedef struct quicklist {
//quicklist The chain head of
quicklistNode *head;
//quicklist The end of the list
quicklistNode *tail;
// Total number of elements in all compressed lists
unsigned long count;
// The number of nodes in the list quicklistNode
unsigned long len;
...
} quicklist;
quicklistNode Structure definition of
typedef struct quicklistNode {
// Pointer to the previous node
struct quicklistNode *prev; // Previous quicklistNode
// Pointer to the back node
struct quicklistNode *next; // After a quicklistNode
//quicklistNode Compressed list pointing to
unsigned char *zl;
// The byte size of the compressed list
unsigned int sz;
// Number of elements in the compressed list
unsigned int count : 16; //ziplist The number of elements in
....
} quicklistNode;
You can see node Nodes have pointers to forward and back nodes , And the element of the node does not store the simple element value , Instead, a compressed linked list is saved , So there is a pointer to the compressed linked list *zl
Data structure chart
In the quicklist When adding an element , Not like an ordinary linked list , Directly create a linked list node . Instead, it will check whether the compressed linked list at the insertion position can accommodate the element , If it can accommodate , Then save it directly to quicklistNode Structure , If it can't hold , To create a new one Node structure .
quicklist Can control quicklistNode The size of the compressed list or the number of elements in the structure , To avoid the risk of potential chain updates , But it has not been completely lifted .
边栏推荐
- How worker threads in the thread pool are recycled
- Tree list under winfrom treelist related
- [splashsplash] repeat the script that outputs splashsurf
- Vsys of Isis (virtual system)
- About database: pgadmin4 editing SQL window
- Un des backtraders du cadre de quantification lit l'analyseur
- redis-7. Redis master-slave replication, cap, Paxos, cluster sharding cluster 02
- Redis learning journey master-slave replication
- Ticdc introduction
- 【splishsplash】重复输出splashsurf的脚本
猜你喜欢
Redis learning journey -- subscription and publishing
redis-2. Redis string type & bitmap
powerdisgner逆向生成oracle数据模型
Redis learning journey -- getting to know redis for the first time
Consistency under distributed
It's called the next generation monitoring system. Let's see how awesome it is
关于#数据库#的问题:PGADMIN4 编辑sql窗口问题
Try to use renderdoc to view the shader code of UE
Simple understanding of basic language of C language
C语言:如何给全局变量起一个别名?
随机推荐
Functions about Oracle.
redis-6. Redis master-slave replication, cap, Paxos, cluster sharding cluster 01
P1434 [SHOI2002] 滑雪 (记忆化搜索
9. process control
Compare advantages and disadvantages of DFS and BFS and name vocabulary
TXT_ File encryption and compression
No configure file found when compiling PHP from source code
About database: pgadmin4 editing SQL window
Redis learning journey - transaction
One article of quantitative framework backtrader read analyzer
理財產品連續幾天收益都是零是怎麼回事?
Ticdc synchronization task
redis-2. Redis string type & bitmap
First graphical interface (modified version)
c#高级编程-特性篇
What languages can be decompiled
部署RDS服务
Postgraduate entrance examination English
It's called the next generation monitoring system. Let's see how awesome it is
Mui mixed development - when updating the download app, the system status bar displays the download progress