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