问题描述
我知道这个问题已经被问过几次了,但是没有一个答案令我满意.这是因为几乎所有人都涉及与数据库相关的巨大读取/写入过程,我希望不惜一切代价避免这样做.
I know this question has been asked here a couple of times, but none of the answers had pleased me. This is because almost all of them involve a huge read / write process related with the database, which I'd like to avoid at all cost.
关于未读的讨论/主题/帖子,有很多需要考虑的地方.我不知道 MyBB , vBulletin , Invision电源板,香草, phpBB 等解决该问题的方法,因此,我想向大家介绍您的经验.我知道,仅为此目的使用数据库表是最简单的方法,但是当社区每月有10,000多个成员和1000个新主题时,这将涉及大量的读/写操作.很难,但是应该有一种避免服务器过载的方法.
About unread discussions / topics / posts, there's a lot to think of. I don't know how do forum systems like MyBB, vBulletin, Invision Power Board, Vanilla, phpBB, etc., cope with that issue, so I'd like to read from you guys your experience with that. I know that using a database table just for that is the simplest way, but that would involve a huge read / write when the community has over 10,000 members and 1000 new topics every month. It's hard, but there should be a way to avoid the server's overloading.
那么,您如何看待该问题的最佳实践以及其他论坛系统如何应对?
So, what do you find as the best practices for this issue, as well as how other forum systems cope with it?
推荐答案
选择不多.
-
标记每个用户的每个阅读器线程.
mark every reader thread by each user.
- 缺点:在非常活跃的论坛中有很多行
- 优点:每个知道帖子的用户都已阅读或未阅读.
标记每个用户的每个未读线程.
mark every unread thread by each user.
- 缺点:如果很多用户不活动,则存在很多空间,其中有未读"行
- 解决方案:添加生存期时间戳记并使用cron删除旧记录
- 优点:每个知道帖子的用户都已阅读或未阅读.
使用时间戳来确定是否显示为未读.
use timestamps to determine if show it as unread or not.
- 缺点:用户不知道的是真正的未读线程,标记仅显示自上次登录以来的新标题"
- 优点:节省空间
另一种选择是混合溶液,即
The other alternative is mixing solutions, that is,
1和3)如果线程不超过X天并且没有为用户标记为已读的行,则将线程显示为未读". X天前可以删除已读"行,而不会影响任何内容.
1 and 3) show thread as "unread" if they aren't older than X days and there isn't a row marked as readed for the user. The "read" rows can be deleted when they are X day older without affect anything.
优势
- 用于确定未读线程的较少间距
缺点
- 创建一个cron以保持系统清洁
- 用户不知道他们读取的线程是否早于x天.
优势
- 每个用户都知道哪些新帖子"已读过.
这篇关于PHP论坛-如何应对未读的讨论/主题/帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!