DelayableQueueInterface
interface DelayableQueueInterface implements QueueInterface (View source)
Delayable queue interface.
Classes implementing this interface allow an item to be released on a delay.
Methods
Delay an item so it runs in the future.
Details
A
createItem($data)
Adds a queue item and store it directly to the queue.
int
numberOfItems()
Retrieves the number of items in the queue.
This is intended to provide a "best guess" count of the number of items in the queue. Depending on the implementation and the setup, the accuracy of the results of this function may vary.
e.g. On a busy system with a large number of consumers and items, the result might only be valid for a fraction of a second and not provide an accurate representation.
On
claimItem($lease_time = 3600)
Claims an item in the queue for processing.
deleteItem($item)
Deletes a finished item from the queue.
bool
releaseItem($item)
Releases an item that the worker could not process.
Another worker can come in and process it before the timeout expires.
createQueue()
Creates a queue.
Called during installation and should be used to perform any necessary initialization operations. This should not be confused with the constructor for these objects, which is called every time an object is instantiated to operate on a queue. This operation is only needed the first time a given queue is going to be initialized (for example, to make a new database table or directory to hold tasks for the queue -- it depends on the queue implementation if this is necessary at all).
deleteQueue()
Deletes a queue and every item in the queue.
bool
delayItem(object $item, int $delay)
Delay an item so it runs in the future.