Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimized cacheable for DefinitionSource. #463

merged 15 commits into from Sep 2, 2019


Copy link

limingxinleo commented Aug 27, 2019

简化 container.php 配置如下

 * Initial a dependency injection container that implemented PSR-11 and return the container.

 * This file is part of Hyperf.
 * @link
 * @document
 * @contact
 * @license

use Hyperf\Di\Container;
use Hyperf\Di\Definition\DefinitionSourceFactory;
use Hyperf\Utils\ApplicationContext;

$container = new Container((new DefinitionSourceFactory(true))());

if (! $container instanceof \Psr\Container\ContainerInterface) {
    throw new RuntimeException('The dependency injection container is invalid.');
return ApplicationContext::setContainer($container);

另外,ConfigProvider 中增加 scan.collectors 配置,可以使用收集器缓存

class ConfigProvider
    public function __invoke(): array
        return [
            'scan' => [
                'collectors' => [
@limingxinleo limingxinleo requested review from huangzhhui and daydaygo Aug 27, 2019
@huangzhhui huangzhhui added this to In progress in Version 1.2 via automation Aug 27, 2019
Version 1.2 automation moved this from In progress to Reviewer approved Sep 1, 2019
Copy link

huangzhhui left a comment

看着没什么问题,但我还没测试,感觉可以先 merge 进来,在后面的开发中再检验这里

@limingxinleo limingxinleo merged commit c9f8eeb into hyperf:master Sep 2, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Version 1.2 automation moved this from Reviewer approved to Done Sep 2, 2019
@limingxinleo limingxinleo deleted the limingxinleo:1.1-collector branch Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Version 1.2
3 participants
You can’t perform that action at this time.