Redis Intset
Based on Redis 7.0.11.
Intset 定义
typedef struct intset {
uint32_t encoding;
uint32_t length;
int8_t contents[];
} intset;encoding:整数的编码方式,实际上表示整数的取值范围(占用字节)。可选值有INSET_ENC_INT16、INSET_ENC_INT32和INSET_ENC_INT64。length:整数个数,通过length和encoding可以计算出contents大小。contents:字节数组,每次 Add 或 Remove 都会引起contents长度变化(realloc)。
升级
升级指 enocding 由较少字节占用扩展到更多字节占用。升级由超过当前 encoding 所能表示的上下限的新元素引起,这个时候新元素要么在 contents 头部,要么在尾部插入。
降级
不支持降级。