Redis basic data structure sds

Original link: http://www.cnblogs.com/turn2i/p/10449411.html

Redis2.6

sds is a basic data structure of character string operations redis

 Source code is structured as follows

. 1  struct sdshdr {
 2  
. 3      // buf length occupied 
. 4      int len;
 . 5  
. 6      // buf remaining usable length 
. 7      int  Free ;
 . 8  
. 9      // where the actual data stored string 
10      char buf [];
 . 11 };
View Code

 Simple to understand, it is a package of the char, so that the string length acquired when the complexity is O (1). From java thinking it can be understood as String.java

Reproduced in: https: //www.cnblogs.com/turn2i/p/10449411.html

Guess you like

Origin blog.csdn.net/weixin_30687587/article/details/94785054