PHP: FIFO queue with APC
A few days ago i needed a simple queue class that would also be persistent after the pagerequest. I first thought about putting this queue in SQL but did not want the whole SQL overhead and such and remembered a blog artice about memcache queues a once read. But i had no memcache for that project and used APC instead.
Basic idea
The basic idea looks like this:
There are 2 counters, one for the current head key, and the other for the current tail key.
The main part of the code is from the mentioned blog artice, but i ported it to PHP and APC instead of Memcache.
Documentation
A generated documentation can be found here:
http://juliusbeckmann.de/classes/li_apc_queue.html
Source
The source can be found here:
http://juliusbeckmann.de/classes/src/apc_queue/class.apc_queue.phps
http://juliusbeckmann.de/classes/src/apc_queue/class.apc_queue.php.txt
Usage
Here is a example how to use the queue:
No related posts.
Wish there was some locking mechanism in send and receive.