Redis
Apprentice
IT从业者
关注领域:Windows驱动开发,数据库设计
展开
-
Redis采用的Hash算法
在Redis中,采用Bernstein的Hash算法,具体代码如下:unsigned int dictGenHashFunction(const unsigned char *buf, int len) { unsigned int hash = 5381; while (len--) hash = ((hash << 5) + hash) + (*buf原创 2012-01-12 08:12:26 · 1891 阅读 · 0 评论 -
Redis代码分析之核心数据结构
在Redis中核心的数据结构有以下一些:1)dict数据结构:typedef struct dict { dictType *type; void *privdata; dictht ht[2]; int rehashidx; int iterators;} dict;其中:原创 2012-01-10 17:55:06 · 699 阅读 · 0 评论