What should I do if I want to perform lazy expiration on the expiration key of redis?

Alibaba cloud Q & A 2022-02-13 08:24:50 阅读数:684

want perform lazy expiration expiration

If you want to Redis The expiration key of is used for inert expiration processing , What to do ?

Take the answer 1:

Only when visiting one key when , Only then can we judge that key Has it expired , If it expires, it will be removed . This strategy can maximize savings CPU resources , But it's not very memory friendly . In extreme cases, there may be a large number of overdue key Not visited again , So it won't be removed , Take up a lot of memory .

copyright:author[Alibaba cloud Q & A],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130824483264.html