class CRM_Queue_Queue_Memory extends CRM_Queue_Queue

A queue implementation which stores items in the CiviCRM SQL database

Properties

array $items
array $releaseTimes
$nextQueueItemId

Methods

__construct(array $queueSpec)

Create a reference to queue. After constructing the queue, one should usually call createQueue (if it's a new queue) or loadQueue (if it's known to be an existing queue).

string
getName()

Determine the string name of this queue.

createQueue()

Perform any registation or resource-allocation for a new queue

loadQueue()

Perform any loading or pre-fetch for an existing queue.

deleteQueue()

Release any resources claimed by the queue (memory, DB rows, etc)

bool
existsQueue()

Check if the queue exists.

createItem(mixed $data, array $options = array())

Add a new item to the queue.

int
numberOfItems()

Determine number of items remaining in the queue.

object
claimItem(int $leaseTime = 3600)

Get and remove the next item.

object
stealItem(int $leaseTime = 3600)

Get the next item.

deleteItem(object $item)

Remove an item from the queue.

releaseItem(object $item)

Return an item that could not be processed.

Details

at line 61
__construct(array $queueSpec)

Create a reference to queue. After constructing the queue, one should usually call createQueue (if it's a new queue) or loadQueue (if it's known to be an existing queue).

Parameters

array $queueSpec Array with keys: - type: string, required, e.g. "interactive", "immediate", "stomp", "beanstalk" - name: string, required, e.g. "upgrade-tasks" - reset: bool, optional; if a queue is found, then it should be flushed; default to TRUE - (additional keys depending on the queue provider).

in CRM_Queue_Queue at line 67
string getName()

Determine the string name of this queue.

Return Value

string

at line 68
createQueue()

Perform any registation or resource-allocation for a new queue

at line 76
loadQueue()

Perform any loading or pre-fetch for an existing queue.

at line 84
deleteQueue()

Release any resources claimed by the queue (memory, DB rows, etc)

at line 94
bool existsQueue()

Check if the queue exists.

Return Value

bool

at line 107
createItem(mixed $data, array $options = array())

Add a new item to the queue.

Parameters

mixed $data Serializable PHP object or array.
array $options Queue-dependent options; for example, if this is a priority-queue, then $options might specify the item's priority.

at line 118
int numberOfItems()

Determine number of items remaining in the queue.

Return Value

int

at line 131
object claimItem(int $leaseTime = 3600)

Get and remove the next item.

Parameters

int $leaseTime Seconds.

Return Value

object with key 'data' that matches the inputted data

at line 161
object stealItem(int $leaseTime = 3600)

Get the next item.

Parameters

int $leaseTime Seconds.

Return Value

object with key 'data' that matches the inputted data

at line 182
deleteItem(object $item)

Remove an item from the queue.

Parameters

object $item The item returned by claimItem.

at line 193
releaseItem(object $item)

Return an item that could not be processed.

Parameters

object $item The item returned by claimItem.