topphp/topphp-pool

通用连接池组件

v1.1.3 2020-07-01 12:34 UTC

This package is auto-updated.

Last update: 2021-12-29 02:41:48 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

简介

一个基于swoole的通用连接池组件

使用

$rpcConfig = App::make(RpcConfig::class, []);
if (isset($config) && !empty($config)) {
    $rpcConfig
        ->setNode($this->node)
        ->setOptions($config['options'])
        ->setMinConnections($config['pool']['min_connections'])
        ->setMaxConnections($config['pool']['max_connections'])
        ->setConnectTimeout($config['pool']['connect_timeout'])
        ->setMaxIdleTime($config['pool']['max_idle_time'])
        ->setWaitTimeout($config['pool']['wait_timeout']);
}
/** @var RpcPool $pool */
$pool   = App::make(RpcPool::class, [
    $rpcConfig,
    10
]);
$client = $pool->get();

注意

现代的PHP组件都使用语义版本方案(http://semver.org), 版本号由三个点(.)分数字组成(例如:1.13.2).第一个数字是主版本号,如果PHP组件更新破坏了向后兼容性,会提升主版本号. 第二个数字是次版本号,如果PHP组件小幅更新了功能,而且没有破坏向后兼容性,会提升次版本号. 第三个数字(即最后一个数字)是修订版本号,如果PHP组件修正了向后兼容的缺陷,会提升修订版本号.

Structure

组件结构

bin/        
build/
docs/
config/
src/
tests/
vendor/

Install

Via Composer

$ composer require topphp/topphp-pool 你的组件名称

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email sleep@kaituocn.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.