gpt4 book ai didi

php - 使用 PHP/MySQL 显示某些统计信息的最有效方式

转载 作者:行者123 更新时间:2023-11-29 01:33:29 25 4
gpt4 key购买 nike

我需要在我们网站的首页显示一些基本统计数据,例如博客数量、成员数量和一些计数 - 所有这些都是基本查询。

我更愿意找到一种方法来运行这些查询,比如每 30 分钟运行一次并存储输出,但我不确定最佳方法,而且我真的不想使用 cron。基本上,我不想每天为了显示这些结果而进行数千次查询。

关于此类功能的最佳方法有什么想法吗?

提前致谢

最佳答案

不幸的是,cron 是更好、更可靠的解决方案。

Cron is a time-based job scheduler in Unix-like computer operating systems. The name cron comes from the word "chronos", Greek for "time". Cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates. It is commonly used to automate system maintenance or administration, though its general-purpose nature means that it can be used for other purposes, such as connecting to the Internet and downloading email.

如果要将输出存储到磁盘文件中,
您可以随时查看 filemtime不到30分钟,
在继续重新运行昂贵的查询之前。

关于php - 使用 PHP/MySQL 显示某些统计信息的最有效方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4224937/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com