Redis数据结构
为什么用Redis
缓存,在内存中,IO多路复用,单线程
Redis有什么用
分布式锁,延迟队列,位图,hyperloglog记录UV,布隆过滤器,限流,GeoHash地理位置计算附近的人。
项目中用到了什么
验证码
Key Value 型
String
底层
ArrayList类似,是字节数组,动态分配长度,字符串长度最大为512M,超过1M会每次增加1M
Simple Dynamic String,支持append操作
SDS
struct SDS {
int8 capacity; // 1byte
int8 len; // 1byte
int8 flags; // 1byte