Redis 字典的实现

Redis 字典的实现Redis 字典的实现

注意 dict 类型使用了两个指针,分别指向两个哈希表。

其中, 0 号哈希表(ht[0])是字典主要使用的哈希表, 而 1 号哈希表(ht[1])则只有在程序对 0 号哈希表进行 rehash 时才使用。

table 属性是个数组, 数组的每个元素都是个指向 dictEntry 结构的指针。

每个 dictEntry 都保存着一个键值对, 以及一个指向另一个 dictEntry 结构的指针:

Redis 字典的实现

整体结构如下:

Redis 字典的实现

参考:http://redisbook.readthedocs.org/en/latest/internal-datastruct/dict.html

相关文章:

  • 2021-07-25
  • 2021-07-20
  • 2021-12-12
  • 2021-12-04
  • 2021-05-30
  • 2018-01-08
  • 2020-07-24
  • 2021-09-16
猜你喜欢
  • 2021-04-23
  • 2021-09-13
  • 2021-10-03
  • 2022-12-23
  • 2022-12-23
  • 2020-12-25
  • 2021-07-11
相关资源
相似解决方案