redis数据存储结构
2020-11-11 21:45:17 2 举报
redis数据存储结构
作者其他创作
大纲/内容
dict
dictType *type
void *privdata
dictht ht[2]
long rehashidx
unsigned long iterators
Kn-Vn
dictht
dictEntry **table
unsigned long size
unsigned long sizemask
unsigned long used
level2
sdshdr16
uint16_t len
uint16_t alloc
unsigned char flags
char buf[]
dictEntry
void *key
union { void *val; uint64_t u64; int64_t s64; double d; } v
struct dictEntry *next
type=1list类型
zipmap
zmlen
key_len
key
val_len
val_free
value
......
hashtable编码
dictEntry *
*p
ziplist
NULL
K1-V1
type=4hash类型
zskiplistNode
sds ele
double score
struct zskiplistNode *backward
struct zskiplistLevel level[]
struct zskiplistNode *forward
unsigned long span
quicklist
quicklistNode *head
quicklistNode *tail
unsigned long count
unsigned long len
int fill : QL_FILL_BITS
unsigned int compress : QL_COMP_BITS
unsigned int bookmark_count: QL_BM_BITS
quicklistBookmark bookmarks[]
leven1
redisObject
unsigned type:4
unsigned encoding:4
unsigned lru:LRU_BITS
int refcount
void *ptr
集合
quicklistLZF
unsigned int sz
char compressed[]
外层hashtable
type=3zset类型
zlbytes
zltail
zllen
entry1
zlend
dictType
uint64_t (*hashFunction)(const void *key)
skiplist编码
zlentry
unsigned int prevrawlensize
unsigned int prevrawlen
unsigned int lensize
unsigned int len
unsigned int headersize
unsigned char encoding
unsigned char *p
字符串 sds
zskiplist
quicklistNode
struct quicklistNode *prev
struct quicklistNode *next
unsigned char *zl
unsigned int count : 16
unsigned int encoding : 2
unsigned int container : 2
unsigned int recompress : 1
unsigned int attempted_compress : 1
unsigned int extra : 10
ziplist编码
不压缩ziplist
redisDb
dict *dict
dict *expires
dict *blocking_keys
dict *ready_keys
dict *watched_keys
int id
long long avg_ttl
unsigned long expires_cursor
list *defrag_later
level1
type=2set类型
struct zskiplistNode *header
struct zskiplistNode *tail
unsigned long length
int level
intset编码
LZF压缩
intset
type=0string类型
uint32_t encoding
uint32_t length
int8_t contents[]
zipmap编码
哈希
字典(hashtable)
列表quicklist
有序集合
收藏
收藏
0 条评论
下一页
为你推荐
查看更多