如下爲我的學習Redis的備忘錄--內存優化,基於Redis4.0.2redis
string | int | 8個字節的長整型 |
embstr | <=39字節的字符串 | |
raw | >39字節的字符串(最大不能超過512MB) | |
hash | ziplist | 壓縮列表(模擬雙向鏈表),內存佔用少,但讀寫時間複雜度爲O(n²) |
hashtable | 哈希表,內存佔用較大,但讀寫時間複雜度爲O(1) | |
list | quicklist (ziplist) | 快速雙向鏈表(每一個節點都是ziplist) |
set | intset | 整數集合 |
hashtable | 哈希表 | |
zset | ziplist | 壓縮列表 |
skiplist | 跳躍表 |
key = username0000 value =strs...key = username9999 value =strs
key = username0 field = 000 value = str ... field =999 value =str...key = username9 field = 000 value = str ... field =999 value =str