zavier / blogs-comments

博客评论
0 stars 0 forks source link

Redis数据结构-SDS | 编码之路 #14

Open zavier opened 5 years ago

zavier commented 5 years ago

https://zhengw-tech.com/2019/01/26/Redis%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84SDS/

基本结构Redis中没有使用C语言原生的字符串,而是在其基础上包装了一个新的数据结构-SDS,其结构如下 1234567891011// 指向下面结构中的buf指针typedef char *sds;struct attribute ((packed)) sdshdr8 { uint8_t len; // 使用到的空间 uint8_t alloc; // 分配