by lukefabish · 16y ago · 0 comments
http://github.com/dhotson/phork
The main use case is something like: Let's say you've got a mysql query that's going to take a few seconds. In the meantime, you can do some other useful work in PHP while the query runs.
I think some basic concurrency support in PHP (such as Futures) would have a pretty huge benefit. The other alternative is to have async APIs for libraries like mysql.
You could argue that anything that is taking too long that it needs parellelizing is probably a candidate for a background queue + frontend polling (or similar).
I first built a working solution in PHP using IPC Shared Memory Segments and later ditched it in favour of PHP+Redis (you could use your own NoSQL datastore of choice of course).
For me, it was way simpler/cleaner to implement and I got a bunch of features for free.