客户端数据结构
客户端底层的数据结构如下:
typedef struct redisClient {
uint64_t id; /* Client incremental unique ID. */
// 套接字描述符
int fd;
redisDb *db;
int dictid;
// 客户端名字
robj name; / As set by CLIENT SETNAME */
// 输入缓冲区,保存客户端发送的命令请求
sds querybuf;
size_t querybuf_peak; /* Recent (100ms or more) peak of querybuf size */
// 命令和命令参数
int argc;
robj **argv;
// 命令实现函数字典
struct redisCommand *cmd, *lastcmd;
int reqtype;
int multibulklen; /* number of multi bulk arguments left to read */
long bulklen; /* length of bulk argument in multi bulk request */
list *reply;
unsigned long reply_bytes; /* Tot bytes of objects in reply list */
int sentlen; /* Amount of bytes already sent in the current
buffer or object being sent. */
// 创建客户端时间
time_t ctime; /* Client cr