This commit is contained in:
2021-02-22 17:44:24 +08:00
parent 3b09b9a308
commit 2d1f83cf09
34 changed files with 732 additions and 222 deletions
+12
View File
@@ -33,6 +33,7 @@ use Snowflake\Exception\ComponentException;
use Snowflake\Exception\InitException;
use Snowflake\Jwt\Jwt;
use Snowflake\Pool\Connection;
use Snowflake\Pool\ObjectPool;
use Snowflake\Pool\Redis as SRedis;
use Snowflake\Snowflake;
use Snowflake\Event;
@@ -404,6 +405,16 @@ abstract class BaseApplication extends Service
}
/**
* @return ObjectPool
* @throws ComponentException
*/
public function getObject(): ObjectPool
{
return $this->get('object');
}
/**
* @throws Exception
*/
@@ -424,6 +435,7 @@ abstract class BaseApplication extends Service
'redis' => ['class' => Redis::class],
'jwt' => ['class' => Jwt::class],
'async' => ['class' => Async::class],
'object' => ['class' => ObjectPool::class],
'goto' => ['class' => BaseGoto::class],
'http2' => ['class' => Http2::class],
]);
+6 -5
View File
@@ -49,11 +49,12 @@ abstract class Pool extends Component
}
/**
* @param $name
* @return array
* @throws Exception
*/
/**
* @param $name
* @param array $callback
* @return array
* @throws Exception
*/
protected function get($name, array $callback): mixed
{
if (!Context::inCoroutine()) {