Class QdbDeque
A queue of blob in the database.
It's a double-ended queue, you can both enqueue and dequeue from the front and the back.
-
qdb\QdbEntry
-
qdb\QdbDeque
Namespace: qdb
Example:
You get a QdbDeque instance by calling \QdbCluster::deque().
Then you can perform atomic operations on the queue:
$queue = $cluster->deque('my queue');
$queue->pushBack('value 0');
$queue->pushBack('value 1');
Methods summary
public
string
|
#
back( )
Gets the element at the end of the queue.
Gets the element at the end of the queue.
Returns
string The last element of the queue.
Throws
Example
$last = $cluster->deque('alias')->back();
|
public
string
|
#
front( )
Gets the element at the beginning of the queue.
Gets the element at the beginning of the queue.
Returns
string The first element of the queue.
Throws
Example
$first = $cluster->deque('alias')->front();
|
public
string
|
#
popBack( )
Dequeues from the end of the queue and returns the value.
Dequeues from the end of the queue and returns the value.
Returns
string The last element of the queue.
Throws
Example
$last = $cluster->deque('alias')->popBack();
|
public
string
|
#
popFront( )
Dequeues from the beginning of the queue and returns the value.
Dequeues from the beginning of the queue and returns the value.
Returns
string The first element of the queue.
Throws
Example
$first = $cluster->deque('alias')->popFront();
|
public
|
#
pushBack( string $content )
Enqueues the specified value at the end of the queue. Creates the queue if needed.
Enqueues the specified value at the end of the queue. Creates the queue if needed.
Parameters
- $content
- The value to enqueue.
Throws
Example
$cluster->deque('alias')->pushBack('content');
|
public
|
#
pushFront( string $content )
Enqueues the specified value at the beginning of the queue. Creates the queue if needed.
Enqueues the specified value at the beginning of the queue. Creates the queue if needed.
Parameters
- $content
- The value to enqueue.
Throws
Example
$cluster->deque('alias')->pushFront('content');
|
public
integer
|
#
size( )
Gets the length of the queue.
Gets the length of the queue.
Returns
integer The number of elements in the queue.
Throws
Example
$elementCount = $cluster->deque('alias')->size();
|