Sitting in a row and eating fruit and fruit - On the type of Redis List

1. Introduction

1.1 Introduction

The List type is also a high-frequency data type. The key value is a string, and the value value is a queue (two-way), storing multiple values.

The data structure presented externally is similar to Java's List<Object> collection

list type it is encoded internally in redis:

quicklist : Before Redis 3.2, Ziplist and linkedList were used as the data structure of the list type. Considering that if a linked list is used to implement, more additional space is required, and the node memory must be allocated separately, which affects memory management efficiency. After Redis3.2, the list data is modified, and the quick list (quickList) is used to replace the ziplist and linkedlist.

quicklist : A linked list with a compressed list as a node. The linked list is divided into segments. Each segment uses a compressed list for continuous memory storage. Multiple compressed lists form a two-way linked list through the prev and next pointers. It combines the advantages of compressed lists and linked lists to further compress memory usage and further improve efficiency.

127.0.0.1:6379> lpush hobby a b c 
(integer) 3
127.0.0.1:6379> object encoding hobby
"quicklist"

 1.2 Data structure

quicklist

<

Guess you like

Origin blog.csdn.net/langfeiyes/article/details/129954768