主要做用: (1)保存数据库中的字符串值; (2)用做缓冲区(AOF缓冲区,客户端状态中的输入缓冲区)redis
struct __attribute__ ((__packed__)) sdshdr32 { uint32_t len; // 记录buf数组中已使用字节的数量 uint32_t alloc; // unsigned char flags; /* 3 lsb of type, 5 unused bits */ char buf[]; };