php可以侦听mysql数据库的更改或更新吗? ...在这里进行实时实时搜索 [英] Can php listen for a mysql database change or update? ...thinking real-time, live search here
问题描述
我正在尝试思考处理网站实时搜索的最佳方法.我唯一能想到的解决方案是每隔几秒钟就不断检查服务器中是否有数据库中的新内容,但这对我来说似乎不太实际.
Im trying to think of the best way to handle real time search for a website. The only solution I can come up with is to keep checking the server every few seconds for something new in the database, but that does not seem very practical to me.
推荐答案
As of 5.0.2 MySQL supports triggers: http://dev.mysql.com/doc/refman/5.0/en/triggers.html
但是不幸的是,我对MySQL的了解不够,无法知道您是否可以对它们进行任何有用的操作"来通知应用程序(在Oracle中,我会考虑使用xp_).至少您可以在一个类似审计的表中写一行,这样您只需要在一个地方进行轮询即可.
But unfortunately I don't know MySQL well enough to know whether you could do anything "useful" in them to notify the app (in Oracle I'd be thinking xp_'s). At very least you could write a row into a single, audit-like table so that you only have to poll in one place.
这篇关于php可以侦听mysql数据库的更改或更新吗? ...在这里进行实时实时搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!