首页 > 解决方案 > 如何确定学说查询缓存是否在 symfony 应用程序中工作

问题描述

Doctrine 建议在生产环境中打开查询缓存,所以在我的情况prod/doctrine.yaml下我打开了它:

doctrine:
    orm:
        auto_generate_proxy_classes: false
        metadata_cache_driver:
            type: pool
            pool: doctrine.system_cache_pool
        query_cache_driver:
            type: pool
            pool: doctrine.system_cache_pool

framework:
    cache:
        pools:
            doctrine.system_cache_pool:
                adapter: cache.system


我的cache.system设置cacge.yaml是这样的:

framework:
    cache:
        system: cache.adapter.filesystem

当然,我也添加./bin/console doctrine:cache:clear-query -e prod到我的部署过程中。但我没有注意到任何速度改进。

现在我的cache.system适配器使用文件系统。我var/cache/prod在打开和不打开查询缓存的情况下运行相同的端点后测量大小,看起来缓存大小是一样的,而且缓存的结构也一样。我可以看到它正在生成原则代理和default_metadata.php文件,但我没有查看与查询缓存相关的任何缓存条目。

有没有办法确定学说查询缓存是否有效?

标签: phpsymfonydoctrine-ormdoctrine

解决方案


推荐阅读