新增 swoole table
This commit is contained in:
parent
2a593b179a
commit
40ed25816c
42
extend/catcher/library/crontab/Table.php
Normal file
42
extend/catcher/library/crontab/Table.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CatchAdmin [Just Like ~ ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: JaguarJack [ njphper@gmail.com ]
|
||||
// +----------------------------------------------------------------------
|
||||
namespace catcher\library\crontab;
|
||||
|
||||
use Swoole\Table as STable;
|
||||
|
||||
trait Table
|
||||
{
|
||||
/**
|
||||
* @var STable
|
||||
*/
|
||||
protected $table;
|
||||
|
||||
protected function createTable()
|
||||
{
|
||||
$this->table = new STable(1024);
|
||||
|
||||
$this->table->column('pid', STable::TYPE_INT, 4); //1,2,4,8
|
||||
$this->table->column('memory', STable::TYPE_INT, 4);
|
||||
$this->table->column('start_at', STable::TYPE_INT, 8);
|
||||
$this->table->column('running_time', STable::TYPE_INT, 8);
|
||||
$this->table->column('status', STable::TYPE_STRING, 15);
|
||||
$this->table->column('deal_tasks', STable::TYPE_INT, 4);
|
||||
$this->table->column('errors', STable::TYPE_INT, 4);
|
||||
$this->table->create();
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected function addColumn($pid, $value)
|
||||
{
|
||||
return $this->table->set($pid, $value);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user