_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 */ public abstract function createQueue(); /** * Perform any loading or pre-fetch for an existing queue. */ public abstract function loadQueue(); /** * Release any resources claimed by the queue (memory, DB rows, etc) */ public abstract function deleteQueue(); /** * Check if the queue exists. * * @return bool */ public abstract 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. */ public abstract function createItem($data, $options = array()); /** * Determine number of items remaining in the queue. * * @return int */ public abstract function numberOfItems(); /** * Get the next item. * * @param int $lease_time * Seconds. * * @return object * with key 'data' that matches the inputted data */ public abstract 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 */ public abstract function stealItem($lease_time = 3600); /** * Remove an item from the queue. * * @param object $item * The item returned by claimItem. */ public abstract function deleteItem($item); /** * Return an item that could not be processed. * * @param object $item * The item returned by claimItem. */ public abstract function releaseItem($item); }