I want to set a validity period of 10 minutes for the value of a certain field. After 10 minutes, it becomes Null. Does mysql have this function?
滿天的星座2017-05-18 10:56:45
Just give a valid time field directly, and the code layer will make a logical judgment and give a null value after the validity period.
给我你的怀抱2017-05-18 10:56:45
Add two fields directly. In fact, you don’t need to change that field to null. You only need to judge the time at the logical level when using it. Mysql itself does not have this function
世界只因有你2017-05-18 10:56:45
It is recommended to use the logic code layer to handle it. After all, the database is only a function of accessing data, and these functions should not be mixed. By adding an additional creation time field, the code can determine whether it has expired.