K2hQueue::__construct
Creates a K2hQueue instance
Description
public K2hQueue::__construct ( mixed $handle_res [, bool $is_fifo [, string $prefix ]] )
Creates a K2hQueue instance.
Parameters
- handle_res
Specifies the k2hash (.k2h
) file handle that k2hpx_open returns. - is_fifo
Specifies true if the order of the K2hQueue is FIFO, otherwise false. - prefix
Specifies the prefix of the K2hQueue.
Examples
- Example 1 - Creates a K2hQueue instance
<?php
$handle = k2hpx_open_mem();
$k2hqueue = new K2hQueue($handle, true, "test_queue_");
var_dump($k2hqueue->count());
$k2hqueue->push("test_queue_data");
var_dump($k2hqueue->count());
var_dump($k2hqueue->pop());
var_dump($k2hqueue->count());
unset($k2hqueue);
k2hpx_close($handle);
?>
The above example will output:
int(0)
int(1)
string(15) "test_queue_data"
int(0)
See Also
- K2hash::getQueue - Gets a K2hQueue object