Add InitBuffer annotation

This commit is contained in:
whale
2020-03-08 16:40:04 +08:00
parent 4af90e00ff
commit 5f43cf4f00
5 changed files with 59 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ use ZM\Annotation\Http\RequestMapping;
use ZM\Annotation\Interfaces\CustomAnnotation;
use ZM\Annotation\Interfaces\Level;
use ZM\Annotation\Module\Closed;
use ZM\Annotation\Module\InitBuffer;
use ZM\Annotation\Module\SaveBuffer;
use ZM\Annotation\Swoole\SwooleEventAfter;
use ZM\Annotation\Swoole\SwooleEventAt;
@@ -52,6 +53,8 @@ class AnnotationParser
$class_prefix = $vs->prefix;
} elseif ($vs instanceof SaveBuffer) {
DataProvider::addSaveBuffer($vs->buf_name, $vs->sub_folder);
} elseif ($vs instanceof InitBuffer) {
ZMBuf::set($vs->buf_name, []);
}
}
foreach ($methods as $vs) {

View File

@@ -0,0 +1,19 @@
<?php
namespace ZM\Annotation\Module;
use Doctrine\Common\Annotations\Annotation\Required;
use Doctrine\Common\Annotations\Annotation\Target;
/**
* Class InitBuffer
* @Annotation
* @Target("CLASS")
* @package ZM\Annotation\Module
*/
class InitBuffer
{
/** @var string @Required() */
public $buf_name;
}