Notes of Redis Design
Simple Dynamic String (SDS)
Section titled “Simple Dynamic String (SDS)”struct sdshdr { int len; int free; char buf[];}Binary safe
Section titled “Binary safe”Uses len instead of \0 to judge the endig of a string.
Linked List
Section titled “Linked List”typedef struct listNode { struct listNode* prev; struct listNode* next; void* value;}listNode;typedef struct list{ listNode* head; listNode* tail; unsigned long len; void *(*dup) (void* ptr); void *(*free) (void* ptr); int *(*match) (void* ptr);}list;