# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
# is reached. You can select among five behaviors:
#
# volatile-lru -> Evict using approximated LRU among the keys with an expire set.
最近最少使用,使用LRU算法移除key,只对设置了过期时间的键
# allkeys-lru -> Evict any key using approximated LRU.
使用LRU算法移除key
# volatile-lfu -> Evict using approximated LFU among the keys with an expire set.
# allkeys-lfu -> Evict any key using approximated LFU.
# volatile-random -> Remove a random key among the ones with an expire set.
在过期的集合中移除随机的key,只对设置了过期时间的键
# allkeys-random -> Remove a random key, any key.
移除随机的key
# volatile-ttl -> Remove the key with the nearest expire time (minor TTL)
移除那些TTL值最小的Key,即那些最近要过期的key
# noeviction -> Don't evict anything, just return an error on write operations.
不进行移除,针对写操作,只是返回错误信息
#
# LRU means Least Recently Used
# LFU means Least Frequently Used
#
# Both LRU, LFU and volatile-ttl are implemented using approximated
# randomized algorithms.
持久化:rdb aof
Rdb:在指定的时间间隔内将内存中的数据集快照写入磁盘
snapshot快照,恢复时是将快照文件直接读到内存中
优点:适合大规模的数据恢复
对数据完整性和一致性要求不高
劣势:
在一定时间间隔做一次备份,所以如果redis意外down掉的话,就会丢失最后一次快照后的所有修改
fork的时候,内存中的数据被克隆了一份,大致2杯的膨胀性需要考虑