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()即可嘛?链接池建立以后直接使用池里的资源嘛,菜鸟在此先谢过了### 问题描述

阅读 3.8k
1 个回答

直接操作client就行了啊

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进