1如果想查看一个键的内部编码 2方式可以使用 OBJECT ENCODING 命令 3 4 5typedef struct redisObject { 6 7 // 类型 8 unsigned type:4; 9 10 // 编码 11 unsigned encoding:4; 12 13 // 对象最后一次被访问的时间 14 unsigned lru:REDIS_LRU_BITS; /* lru time (relative to server.lruclock) */ 15 16 // 引用计数 17 int refcount; 18 19 // 指向实际值的指针 20 void *ptr; 21 22} robj; 23 24 25/* Object types */ 26#define REDIS_STRING 0 27#define REDIS_LIST 1 28#define REDIS_SET 2 29#define REDIS_ZSET 3 30#define REDIS_HASH 4 31 32#define REDIS_ENCODING_RAW 0 /* Raw representation */ 33#define REDIS_ENCODING_INT 1 /* Encoded as integer */ 34#define REDIS_ENCODING_HT 2 /* Encoded as hash table */ 35#define REDIS_ENCODING_ZIPMAP 3 /* Encoded as zipmap */ 36#define REDIS_ENCODING_LINKEDLIST 4 /* Encoded as regular linked list */ 37#define REDIS_ENCODING_ZIPLIST 5 /* Encoded as ziplist */ 38#define REDIS_ENCODING_INTSET 6 /* Encoded as intset */ 39#define REDIS_ENCODING_SKIPLIST 7 /* Encoded as skiplist */ 40#define REDIS_ENCODING_EMBSTR 8 /* Embedded sds string encoding */
