PHP Class Jenner\SimpleFork\Queue\SystemVMessageQueue

Inheritance: implements Jenner\SimpleFork\Queue\QueueInterface
Show file Open project: huyanping/simple-fork-php

Protected Properties

Property Type Description
$block_send boolean
$ipc_filename string
$key_t
$maxsize integer
$msg_type channel
$option_receive integer
$queue
$serialize_needed boolean

Public Methods

Method Description
__construct ( string $ipc_filename = __FILE__, integer $channel = 1, boolean $serialize_needed = true, boolean $block_send = true, integer $option_receive = MSG_IPC_NOWAIT, integer $maxsize = 100000 )
__destruct ( )
__wakeup ( ) init when wakeup
get ( boolean $block = false ) : boolean | string get message
getIpcKey ( $ipc_filename, $msg_type ) : integer
put ( $message ) : boolean put message
queueExists ( $key ) : boolean check if the queue is exists or not
remove ( ) : boolean remove queue
setMaxQueueSize ( $size ) : boolean update the max size of queue need root
setStatus ( string $key, integer $value ) : boolean allows you to change the values of the msg_perm.uid, msg_perm.gid, msg_perm.mode and msg_qbytes fields of the underlying message queue data structure
size ( ) : mixed get the size of queue
status ( )

Protected Methods

Method Description
initQueue ( $ipc_filename, $msg_type ) init queue

Private Methods

Method Description
checkSetPrivilege ( $key ) check the privilege of update the queue's status

Method Details

__construct() public method

public __construct ( string $ipc_filename = __FILE__, integer $channel = 1, boolean $serialize_needed = true, boolean $block_send = true, integer $option_receive = MSG_IPC_NOWAIT, integer $maxsize = 100000 )
$ipc_filename string ipc file to make ipc key. if it does not exists, it will try to create the file.
$channel integer message type
$serialize_needed boolean serialize or not
$block_send boolean if block when the queue is full
$option_receive integer if the value is MSG_IPC_NOWAIT it will not going to wait a message coming. if the value is null, it will block and wait a message
$maxsize integer the max size of queue

__destruct() public method

public __destruct ( )

__wakeup() public method

init when wakeup
public __wakeup ( )

get() public method

get message
public get ( boolean $block = false ) : boolean | string
$block boolean if block when the queue is empty
return boolean | string

getIpcKey() public method

public getIpcKey ( $ipc_filename, $msg_type ) : integer
$ipc_filename
$msg_type
return integer

initQueue() protected method

init queue
protected initQueue ( $ipc_filename, $msg_type )
$ipc_filename
$msg_type

put() public method

put message
public put ( $message ) : boolean
$message
return boolean

queueExists() public method

check if the queue is exists or not
public queueExists ( $key ) : boolean
$key
return boolean

remove() public method

remove queue
public remove ( ) : boolean
return boolean

setMaxQueueSize() public method

update the max size of queue need root
public setMaxQueueSize ( $size ) : boolean
$size
return boolean

setStatus() public method

allows you to change the values of the msg_perm.uid, msg_perm.gid, msg_perm.mode and msg_qbytes fields of the underlying message queue data structure
public setStatus ( string $key, integer $value ) : boolean
$key string status key
$value integer status value
return boolean

size() public method

get the size of queue
public size ( ) : mixed
return mixed

status() public method

public status ( )

Property Details

$block_send protected property

protected bool $block_send
return boolean

$ipc_filename protected property

protected string $ipc_filename
return string

$key_t protected property

protected $key_t

$maxsize protected property

protected int $maxsize
return integer

$msg_type protected property

channel
protected $msg_type

$option_receive protected property

protected int $option_receive
return integer

$queue protected property

protected $queue

$serialize_needed protected property

protected bool $serialize_needed
return boolean