I'm trying to think of a way to do something efficiently, but am at a dead end.
Essentially, what I want to do is to have a queue (in the form of a MySQL Table), and I want to do something with each entry of the table.
There are two things that cause me problems with this, however:
1) Items can be added to the queue at any time (And a lot of the time it is going to be empty)
2) There needs to be a 30 second delay between each event firing (So 30 seconds per row).
The best example I can think of that would be easy to relate to would be to say that my mail server only lets me send one mail per 30 seconds and I wanted to do lost password requests and signup confirmations via E-mail.
So, in theory, I would just add a row to the table any time I wanted to send out an E-mail. Have the subject, id (for ordering), and message, and then there would be some way of calling a script that would send one every 30 seconds until the queue was empty.
I would also like to not use a normal cron tab because I don't want it firing every 30 seconds because that would obviously be an unneeded strain on the server.
Any ideas?