PHP Performance Research - Cache (3)

zhaozj2021-02-16  85

Thinking is a bit confusing, not because of other things, because the previous written is too chaotic.

The biggest problem in Cache is how to control the validity period.

Practice 1: Actively update. When there is a new data entry or data update, delete the corresponding Cache. This advantage is that data updates are timely. The drawback is that the determination of Cache is difficult, especially the list, etc .; data update is relatively large, a large number of data updates will result in burden.

Practice 2: Passive update, set the survival time of Cache. One of them is, make a message queue, a process constantly scan the queue to determine the cache that should be deleted, and delete it. The other is that when Cache data is called, determine whether the Cache generated time is determined whether to update the Cache data.

转载请注明原文地址:https://www.9cbs.com/read-13657.html

New Post(0)