字典结构
typedef struct dict{
dictType *type;
void *privdata;
dictht ht[2]; //哈希表 使用ht[0],ht[1]用于rehash
int rehashidx; //当rehash不在进行时,值为-1;记录rehash进度
}dict;
hash值计算公式: hash = dict->type->hashFunction(key);
Category: 每天读一点
SDS simple dynamic string
redis 默认字符串
结构:
struct sdshdr{
int len;
int free;
char buf[];
};
打印 printf("%s",s->buf);