Redis learning-dictionary

Source: Internet
Author: User
Tags rehash

1. Functions of dictionaries

    1. Implement the key space of the database );
    2. One of the underlying implementations of hash keys;

2. Data Structure implemented by the dictionary

typedef struct dict {    // 特定于类型的处理函数    dictType *type;    // 类型处理函数的私有数据    void *privdata;    // 哈希表(2 个)    dictht ht[2];    // 记录 rehash 进度的标志,值为 -1 表示 rehash 未进行    int rehashidx;    // 当前正在运作的安全迭代器数量    int iterators;} dict;

/* * 哈希表 */typedef struct dictht {    // 哈希表节点指针数组(俗称桶,bucket)    dictEntry **table;    // 指针数组的大小    unsigned long size;    // 指针数组的长度掩码,用于计算索引值    unsigned long sizemask;    // 哈希表现有的节点数量    unsigned long used;} dictht;

/* * 哈希表节点 */typedef struct dictEntry {    // 键    void *key;    // 值    union {        void *val;        uint64_t u64;        int64_t s64;    } v;    // 链往后继节点    struct dictEntry *next;} dictEntry;
 
 

Redis learning-dictionary

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.