Scale-of-evaluation / daily-question

This repo is used to help you better understand the world,Enjoy!
MIT License
4 stars 2 forks source link

【08.28】Redis的内存用完了会发生什么? #228

Open changjl317 opened 3 years ago

changjl317 commented 3 years ago

请在下面作答

Derek-94tm commented 3 years ago

这个跟 Redis 的内存回收策略有关。 Redis 的默认回收策略是 noenviction,当内存用完之后,写数据会报错。 Redis 的其他内存回收策略含义: volatile-lru:从已设置过期时间的数据集(server.db[i].expires)中,淘汰最近最少使用的数据 volatile-ttl:从已设置过期时间的数据集(server.db[i].expires)中,淘汰最早会过期的数据 volatile-random:从已设置过期时间的数据集(server.db[i].expires)中,随机淘汰数据 allkeys-lru:从数据集(server.db[i].dict)中,淘汰最近最少使用的数据 allkeys-random:从数据集(server.db[i].dict)中,随机淘汰数据