_name = $queueSpec['name']; } /** * Determine the string name of this queue. * * @return string */ public function getName() { return $this->_name; } /** * Perform any registation or resource-allocation for a new queue */ abstract public function createQueue(); /** * Perform any loading or pre-fetch for an existing queue. */ abstract public function loadQueue(); /** * Release any resources claimed by the queue (memory, DB rows, etc) */ abstract public function deleteQueue(); /** * Check if the queue exists. * * @return bool */ abstract public function existsQueue(); /** * Add a new item to the queue. * * @param mixed $data * Serializable PHP object or array. * @param array $options * Queue-dependent options; for example, if this is a * priority-queue, then $options might specify the item's priority. */ abstract public function createItem($data, $options = []); /** * Determine number of items remaining in the queue. * * @return int */ abstract public function numberOfItems(); /** * Get the next item. * * @param int $lease_time * Seconds. * * @return object * with key 'data' that matches the inputted data */ abstract public function claimItem($lease_time = 3600); /** * Get the next item, even if there's an active lease * * @param int $lease_time * Seconds. * * @return object * with key 'data' that matches the inputted data */ abstract public function stealItem($lease_time = 3600); /** * Remove an item from the queue. * * @param object $item * The item returned by claimItem. */ abstract public function deleteItem($item); /** * Return an item that could not be processed. * * @param object $item * The item returned by claimItem. */ abstract public function releaseItem($item); }