用于在后台更新 mysql 数据库的守护程序软件

发布于 2024-12-01 09:55:34 字数 265 浏览 0 评论 0原文

我正在编写一个实时 wep 应用程序,类似于拍卖网站。问题是我需要一个守护进程脚本,最好是 php,它在后台运行并不断启动对 mysql 数据库的查询,并根据一些条件(结果集中的时间和条件)更新其他表。守护进程的性能至关重要。示例用例:我们有一笔交易将在 2 分 37 秒后到期。即使没有人观看/竞标,我们也需要在它开始后的 2:37 内准确到期。

任何人都可以建议执行此类任务的最佳编程技术/软件吗?

预先感谢

更新:交易到期时需要执行查询,无论用户是否曾经访问过。

I'm writing a realtime wep application, something similar to auction site. The problem is that I need a daemon script, preferrably php, that runs in background and constantly launches queries to mysql db and basing on some of criterias (time and conditions from resultsets) updates other tables. Performance of the daemon is crucial. Sample use case: we have a deal that is going to expire in 2:37 minutes. Even if nobody is watching/bidding it we need to expire it exactly in 2:37 since the time it started.

Can anybody advise a programming technology/software that performs this kind of task the best?

Thanks in advance

UPDATED: need to perform a query when a deal expires, no matter if it has ever been accessed by a user or not.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

眼睛会笑 2024-12-08 09:55:34

为什么需要按时间间隔触发查询?你不能改变你的前端的工作方式吗?

例如,在“交易”页面中,仅显示尚未过期的交易 - 简化示例:

SELECT * FROM Deal WHERE NOW() <= DateTimeToExpire

相应地,对于“订单”页面,只有在时间尚未过期的情况下,交易才能成为已下订单。

Why do you need to fire queries at time intervals? Can't you just change how your frontend works?

For example, in the "Deals" page, just show only deals that haven't expired - simplified example:

SELECT * FROM Deal WHERE NOW() <= DateTimeToExpire

Accordingly for the "Orders" page, a deal can become a placed order only if time hasn't expired yet.

流云如水 2024-12-08 09:55:34

您的守护进程需要立即触发操作吗?如果您需要一个包含过期状态作为列的表,您可以即时计算过期值或定义一个视图吗?然后,如果您必须发送电子邮件或执行一些清理工作等,您可以使用守护进程/cron 作业每 10 分钟左右查询一次视图。

Does your daemon need to trigger actions instantaneously? If you need a table containing the expired state as a column you could just compute the expire value on the fly or define a view? You could then use a daemon/cron job querying the view every 10 minutes or so if you have to send out emails or do some cleanup work etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文