简体   繁体   中英

How can one update an ETS table via mysql triggers

I need to update an ETS table from changes made to a mysql table: the mysql table is accessible from within the erlang application.

I'm thinking that maybe I could have a process waiting to update the ETS table, while the mysql table gets updated from some sort of web app.

Any and all input appreciated, please let me know if I can supply any more information.

Thanks.

MySQL has no notification infrastructure, so you can't do it automatically, you have to do it with polling. You can make a table with one row which contains time of last update and then create triggers which update this table when relevant rows change. Then continuously check this table to see if it changed.

If you could switch to PostgreSQL, it has LISTEN/NOTIFY commands . With epgsql driver you can add pid of a process which will receive those notifications.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM