This class is designed to place users into a queue, so that only one user can execute some code at a time.
Eg. If you want a certain MySQL query to be executed at a time.
str $queue_table
This is the MySQL table were the queue is stored. (Default: "queue")
int $timeout
The timeout on the queue, this is how long (in seconds) a user can be in the queue without calling the updateTime() function (Default: 2)
str $user
User id for the queue (This is automaticly generated or can be set)
int $qid
The queue id
float $qTime
Time (in seconds [5 D.P]) the user has been in the queue. Set after waitInLine() function is called
void Queue(int $qid)
Initial function, sets the queue id.
void setQueueTable(str $queue_table) [Optional] Defailt: queue
Set the queue MySQL table
void setTimeout(int $timeout) [Optional] Default: 2
Sets the queue time-out
void getInQueue()
Puts the user into the queue
void getOutOfQueue()
Removes the user from the queue
str getFirstInLine()
Returns the first person in the queue
void cleanQueue()
Removes users from the queue which have timed-out
void updateTime()
Updates the users queue time
float queueTime()
Returns the queue time
bool isInQueue()
Returns true if the user is in the queue.
bool waitInLine()
This is were you 'wait in the line', this functions loops until either the user is at the top of the queue or has been remove (due to time-out) from the queue.
Returns true when everthing is ok (reached the top of the line) and false is the user has been kick out.