PHP Class Swoole\Async\Pool

Mostra file Open project: matyhtf/swoole_framework Class Usage Examples

Protected Properties

Property Type Description
$config
$createFunction
$failureCount
$idlePool SplQueue
$poolSize integer 连接池的尺寸,最大连接数
$resourceNum
$resourcePool array idle connection
$taskQueue SplQueue

Public Methods

Method Description
__construct ( array $config = [], integer $poolSize = 100 )
create ( $callback )
failure ( ) 失败计数
getConfig ( ) : array
join ( $resource ) 加入到连接池中
release ( $resource ) 释放资源
remove ( $resource ) : boolean 移除资源
request ( callable $callback ) : boolean 请求资源
setPoolSize ( $newSize ) 修改连接池尺寸

Protected Methods

Method Description
doTask ( )

Method Details

__construct() public method

public __construct ( array $config = [], integer $poolSize = 100 )
$config array
$poolSize integer

create() public method

public create ( $callback )
$callback

doTask() protected method

protected doTask ( )

failure() public method

失败计数
public failure ( )

getConfig() public method

public getConfig ( ) : array
return array

join() public method

加入到连接池中
public join ( $resource )
$resource

release() public method

释放资源
public release ( $resource )
$resource

remove() public method

移除资源
public remove ( $resource ) : boolean
$resource
return boolean

request() public method

请求资源
public request ( callable $callback ) : boolean
$callback callable
return boolean

setPoolSize() public method

修改连接池尺寸
public setPoolSize ( $newSize )
$newSize

Property Details

$config protected_oe property

protected $config

$createFunction protected_oe property

protected $createFunction

$failureCount protected_oe property

protected $failureCount

$idlePool protected_oe property

protected SplQueue $idlePool
return SplQueue

$poolSize protected_oe property

连接池的尺寸,最大连接数
protected int $poolSize
return integer

$resourceNum protected_oe property

protected $resourceNum

$resourcePool protected_oe property

idle connection
protected array $resourcePool
return array

$taskQueue protected_oe property

protected SplQueue $taskQueue
return SplQueue