PHP 클래스 UrbanIndo\Yii2\Queue\Queues\DbQueue

The schema of the table should follow: CREATE TABLE queue ( id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT, status TINYINT NOT NULL DEFAULT 0, timestamp DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, data BLOB ); The queue works under the asumption that the id fields is AUTO_INCREMENT and the timestamp will be set using current timestamp. For other implementation, override the fetchLatestRow method and postJob method.
부터: 2016.01.16
저자: Petra Barus ([email protected])
상속: extends UrbanIndo\Yii2\Queue\Queue
파일 보기 프로젝트 열기: urbanindo/yii2-queue

공개 프로퍼티들

프로퍼티 타입 설명
$db string | yii\db\Connection This will use default db component from Yii application.
$hardDelete boolean Whether to do hard delete of the deleted job, instead of just flagging the status.
$tableName string The table should be pre-created as follows for MySQL: php CREATE TABLE queue ( id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT, status TINYINT NOT NULL DEFAULT 0, timestamp DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, data LONGBLOB );

공개 메소드들

메소드 설명
deleteJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean Delete the job. Override this for the queue implementation.
getSize ( ) : integer Returns the number of queue size.
init ( ) : void
purge ( ) : boolean Purge the whole queue.
releaseJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean Restore job from active to ready.

보호된 메소드들

메소드 설명
fetchJob ( ) : UrbanIndo\Yii2\Queue\Job | boolean Return next job from the queue.
fetchLatestRow ( ) : array Fetch latest ready job from the table.
flagRunningRow ( array $row ) : boolean Flag a row as running. This will update the row ID and status if ready.
postJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean Post new job to the queue. This contains implementation for database.

메소드 상세

deleteJob() 공개 메소드

Delete the job. Override this for the queue implementation.
public deleteJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean
$job UrbanIndo\Yii2\Queue\Job The job to delete.
리턴 boolean whether the operation succeed.

fetchJob() 보호된 메소드

Return next job from the queue.
protected fetchJob ( ) : UrbanIndo\Yii2\Queue\Job | boolean
리턴 UrbanIndo\Yii2\Queue\Job | boolean the job or false if not found.

fetchLatestRow() 보호된 메소드

Due to the use of AUTO_INCREMENT ID, this will fetch the job with the largest ID.
protected fetchLatestRow ( ) : array
리턴 array

flagRunningRow() 보호된 메소드

Flag a row as running. This will update the row ID and status if ready.
protected flagRunningRow ( array $row ) : boolean
$row array The row to update.
리턴 boolean Whether successful or not.

getSize() 공개 메소드

Returns the number of queue size.
public getSize ( ) : integer
리턴 integer

init() 공개 메소드

public init ( ) : void
리턴 void

postJob() 보호된 메소드

Post new job to the queue. This contains implementation for database.
protected postJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean
$job UrbanIndo\Yii2\Queue\Job The job to post.
리턴 boolean whether operation succeed.

purge() 공개 메소드

Purge the whole queue.
public purge ( ) : boolean
리턴 boolean

releaseJob() 공개 메소드

Restore job from active to ready.
public releaseJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean
$job UrbanIndo\Yii2\Queue\Job The job to restore.
리턴 boolean whether the operation succeed.

프로퍼티 상세

$db 공개적으로 프로퍼티

This will use default db component from Yii application.
public string|Connection,yii\db $db
리턴 string | yii\db\Connection

$hardDelete 공개적으로 프로퍼티

Whether to do hard delete of the deleted job, instead of just flagging the status.
public bool $hardDelete
리턴 boolean

$tableName 공개적으로 프로퍼티

The table should be pre-created as follows for MySQL: php CREATE TABLE queue ( id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT, status TINYINT NOT NULL DEFAULT 0, timestamp DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, data LONGBLOB );
public string $tableName
리턴 string