summer
  • 0
  • 新人请关照

hyperf的pool使用问题

<?php

use Hyperf\Pool\SimplePool\PoolFactory;
use Swoole\Coroutine\Http\Client;

$factory = $container->get(PoolFactory::class);

$pool = $factory->get('your pool name', function () use ($host, $port, $ssl) {
    return new Client($host, $port, $ssl);
}, [
    'max_connections' => 50
]);

$connection = $pool->get();

$client = $connection->getConnection(); // 即上述 Client.

// Do something.

$connection->release();

var_dump($connection->check());结果为true;请问此处Do something是直接使用DB::table()即可嘛?链接池建立以后直接使用池里的资源嘛,菜鸟在此先谢过了### 问题描述

阅读 353
评论 更新于 2019-12-06
    1 个回答

    直接操作client就行了啊

    评论 赞赏 2019-12-31