Redis 源码在哪里
源码分析参考书推荐
- 《Redis 设计与实现》黄健宏
- 《Redis5 设计与源码分析》陈雷
Redis 核心源码
src 源码包下面该如何看?源码分析思路,这么多你如何看?面向考点分析源码,外面考什么就看什么;分类。
Redis 基本的数据结构(骨架)
-
Github 官网说明
Other C files
t_hash.c
,t_list.c
,t_set.c
,t_string.c
,t_zset.c
andt_stream.c
contains the implementation of the Redis data types. They implement both an API to access a given data type, and the client command implementations for these data types.ae.c
implements the Redis event loop, it's a self contained library which is simple to read and understand.sds.c
is the Redis string library, check https://github.com/antirez/sds (opens in a new tab) for more information.anet.c
is a library to use POSIX networking in a simpler way compared to the raw interface exposed by the kernel.dict.c
is an implementation of a non-blocking hash table which rehashes incrementally.cluster.c
implements the Redis Cluster. Probably a good read only after being very familiar with the rest of the Redis code base. If you want to readcluster.c
make sure to read the Redis Cluster specification (opens in a new tab).
- Redis 对象 object.c
- 字符串 t_string.c
- 列表 t_list.c
- 字典 t_hash.c
- 集合及有序集合 t_set.c 和 t_zset.c
- 数据流 t_stream.c ;Streams 的底层实现结构 listpack.c 和 rax.c(了解)
-
简单动态字符串 sds.c
-
整数集合 intset.c
-
压缩列表 ziplist.c
-
快速链表 quicklist.c
-
listpack.c
-
字典 dict.c
Redis 数据库的实现
- 数据库的底层实现 db.c
- 持久化 rdb.c 和 aof.c
Redis 服务端和客户端实现
- 事件驱动 ae.c 和 ae.epoll.c
- 网络连接 anet.c 和 networking.c
- 服务端程序 server.c
- 客户端程序 redis-cli.c
其他
- 主从复制 replication.c
- 哨兵 sentinel.c
- 集群 cluster.c
- 其他数据结构,如 hyperloglog.c、geo.c 等
- 其他功能,如 pub/sub、Lua 脚本