开发者社区> 问答> 正文

Redis中的字典(dict)结构是如何定义的?

Redis中的字典(dict)结构是如何定义的?

展开
收起
不吃核桃 2024-08-13 23:47:10 9 0
1 条回答
写回答
取消 提交回答
  • Redis中的字典(dict)结构定义如下:

    c
        typedef struct dict { 
        dictType *type; 
        void *privdata; 
        dictht ht[2]; // 通常只使用一个,但在扩容缩容时使用两个 
        long rehashidx; /* rehashing not in progress if rehashidx == -1 */ 
        int iterators; /* number of iterators currently running */ 
        } dict;
    

    其中包含了类型信息、私有数据、两个哈希表(dictht)的数组、重哈希索引以及当前运行的迭代器数量。

    2024-08-14 08:05:19
    赞同 1 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
ApsaraDB for Redis——与创客同行 立即下载
微博的Redis定制之路 立即下载
云数据库Redis版的开源之路 立即下载