Redis对象的编码方式

136 阅读1分钟

字符串对象

  • int: 存的整数
  • embstr:存的短字符串,len <32字节
  • raw :存的长字符串,最大不能超过512MB

列表对象

  • ziplist 元素小于512个,每个元素len<64字节
  • linkedlist 其他

哈希对象

  • ziplist 元素小于512个,每个元素len<64字节
  • hashtable 其他

集合对象

  • intset 都是int型,元素小于512个
  • hashtable 其他

有序集合对象

  • ziplist 元素小于128个,每个元素len<64字节
  • skiplist+dict 其他