redis中的数据过期后是如何处理的呢?
黄舟
黄舟 2017-04-21 11:18:35
0
3
638

redis可以设置数据过期时间,如果一个数据过期是如何处理的呢?是有一个计时器实时删除吗?这样太低效了。是下次使用的时候再判断吗?这样随着数据的增多,会不会判断时间越来越长?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(3)
黄舟

In this regard, you can search for Redis expiration strategy. There are many related articles. I only understand and use Redis and have not studied the principles in depth.

刘奇

This article has instructions: http://www.cppblog.com/richbirdandy/archive/2011/11/29/161184.html

The above three ways to delete expired keys. The second way is to regularly delete a certain proportion of keys. The first way is "delete while reading" to ensure that expired keys will not be accessed. The third way is to delete expired keys when the memory is exceeded. Violent means during setting. From this we can also see the ingenuity of redis design,

黄舟

Lazy deletion and regular deletion, please see "Redis Design and Implementation" for detailed explanation

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!