MySQL 是否有某种功能可以在 x 秒后使特定行过期?
例如,我必须以下数据库:
users
id - integer
name - string
subscriptions
id - integer
name - string
user_subscriptions
id - integer
user_id - integer
subscription_id - integer
created_at - date
updated_at - date
在本例中,我们有一个数据透视表 user_subscriptions,我想在 x 秒内自动删除 user_subscriptions 中的一行
这在 MySQL 中可能吗?如果可以的话,如何实现?
最佳答案
您可以创建按计划运行的事件来整理数据库
这将独立于 PHP 和 CRON 运行。
但是要小心不要锁表
关于php - MySQL 过期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24572171/