Properties

$name

$name : string

池子名称

Type

string

$pool

$pool : array<mixed,\Imi\Pool\PoolItem>

池子存储

Type

array<mixed,\Imi\Pool\PoolItem>

$resourceConfig

$resourceConfig : mixed

资源配置

Type

mixed

$gcTimerId

$gcTimerId : integer

垃圾回收定时器ID

Type

integer

$heartbeatTimerId

$heartbeatTimerId : integer

心跳定时器ID

Type

integer

$configIndex

$configIndex : integer

当前配置序号

Type

integer

$addingResources

$addingResources : integer

正在添加中的资源数量

Type

integer

Methods

__construct()

__construct(\Imi\Pool\string  $name, \Imi\Pool\Interfaces\IPoolConfig  $config = null,   $resourceConfig = null) 

Parameters

\Imi\Pool\string $name
\Imi\Pool\Interfaces\IPoolConfig $config
$resourceConfig

__init()

__init() 

getName()

getName() : string

获取池子名称

Returns

string

open()

open() : void

打开池子

close()

close() : void

关闭池子,释放所有资源

gc()

gc() : void

资源回收

fillMinResources()

fillMinResources() : void

填充最少资源数量

startAutoGC()

startAutoGC() : void

开始自动垃圾回收

stopAutoGC()

stopAutoGC() : void

停止自动垃圾回收

getResourceConfig()

getResourceConfig() : mixed

获得资源配置

Returns

mixed

getCount()

getCount() : integer

获取当前池子中资源总数

Returns

integer

getUsed()

getUsed() : integer

获取当前池子中正在使用的资源总数

Returns

integer

heartbeat()

heartbeat() : void

心跳

startHeartbeat()

startHeartbeat() : void

开始心跳维持资源

stopHeartbeat()

stopHeartbeat() : void

停止心跳维持资源

initQueue()

initQueue() : void

初始化队列

buildQueue()

buildQueue() : void

建立队列

getNextResourceConfig()

getNextResourceConfig() : mixed

获取下一个资源配置

Returns

mixed