redis-原理-对象-hash对象(九) hash对象底层的数据结构 编码转换

hash对象的编码可以是ziplist(压缩列表)或者linkendlist   注:3.2版本都是用quicklist

ziplist

127.0.0.1:0>hset profile name tom
1

127.0.0.1:0>hset profile age 25
1
127.0.0.1>hset profile career Programmer

数据结构

redis-原理-对象-hash对象(九)
hash对象底层的数据结构
编码转换

hashtable

127.0.0.1:0>hset profile name tom
1

127.0.0.1:0>hset profile age 25
1


127.0.0.1>hset profile career Programmer

数据结构

redis-原理-对象-hash对象(九)
hash对象底层的数据结构
编码转换

编码转换

1.键和值长度都小于64同时键值对个数要小于512使用ziplist否则使用hashtable

可以通过以下参数进行修改

    hash-max-ziplist-value和hash-max-ziplist-entries