当前位置:网站首页>Redis linked list

Redis linked list

2022-06-26 02:04:00 Yunhu doesn't like it

Linked list

Redis Build your own linked list implementation , There are list keys where you use them 、 Publish and subscribe 、 The slow query 、 Monitors, etc

listNode{
// Front node 
struct listNode prev;
// Post node 
struct listNode next;
// The value of the node 
void = value;

}
list{
	// Head node 
	listNode head;
    // Tail node 
    listNode tail;
    // Number of nodes in the list 
	unsingned long len;
	// Node assignment function 
	void dup(void ptr);
	// Node release function 
	void free(void ptr);
	// Node value comparison function 
	int match(void ptr,void key)
}

characteristic

  • The complexity of obtaining pre and post nodes with pre and post pointers is O(1)
  • acyclic : Head and tail pointing null
  • list The time complexity of obtaining the head node and tail node of the structure is O(1)
  • Linked list length count use len Count The time complexity of obtaining length is O(1)
原网站

版权声明
本文为[Yunhu doesn't like it]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260022577241.html