01 2018 档案
摘要:
说到 ___hash table___ 有两个东西是我们经常会碰到的,首先就是 ___hash 碰撞___ 问题,__redis dict__ 是采用链地址法来解决,___dictEntry->next___ 就是指向下个冲突 __key__ 的节点。
还有一个经常碰到的就是 __rehash__ 的问题,提到 __rehash__ 我们还是有点担心性能的。那么redis 实现是非常巧妙的,采用 ___惰性渐进式 rehash 算法___ 。
阅读全文

摘要:
redis 为我们提供了 5 种数据类型,基本上我们使用频率最高的就是 string ,而对其他四种数据类型使用的频次稍弱于 string 。
一方面是由于 string 使用起来比较简单,可以方便存储复杂大对象,使用场景比较多。还有一个原因就是由于 redis expire time 只能设置在 key 上,像 list、hash、set、zset 属于集合类型,会管理一组 item,我们无法在这些集合的 item 上设置过期时间,所以使用 expire time 来处理集合的 cache 失效会变得稍微复杂些。但是 string 使用 expire time 来管理过期策略会比较简单,因为它包含的项少。这里说的集合是宽泛的类似集合。
导致我们习惯性的使用 string
阅读全文
