在 Symfony4 中,我使用以下配置进行教义 apcu 缓存:
doctrine:
orm:
auto_mapping: true
auto_generate_proxy_classes: false
metadata_cache_driver: apcu
query_cache_driver: apcu
result_cache_driver: apcu
升级到 Symfony5 后出现错误:
为实体中的缓存“metadata_cache”配置的“apc”类型的未知缓存
经理“默认”。
当将其更改为以下配置时,它可以工作:
doctrine:
orm:
auto_mapping: true
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
result_cache_driver:
type: pool
pool: doctrine.result_cache_pool
但我现在使用什么样的缓存呢?我怎样才能将它切换到apcu?
我在 Symfony 4.4.5 中遇到了同样的问题
您应该首先安装Symfony 缓存组件。然后,您应该配置缓存池、服务和学说缓存,如下所示:
doctrine:
orm:
auto_generate_proxy_classes: false
metadata_cache_driver:
type: service
id: doctrine.system_cache_provider
query_cache_driver:
type: service
id: doctrine.system_cache_provider
result_cache_driver:
type: service
id: doctrine.result_cache_provider
services:
doctrine.result_cache_provider:
class: Symfony\Component\Cache\DoctrineProvider
public: false
arguments:
- '@doctrine.result_cache_pool'
doctrine.system_cache_provider:
class: Symfony\Component\Cache\DoctrineProvider
public: false
arguments:
- '@doctrine.system_cache_pool'
framework:
cache:
pools:
doctrine.result_cache_pool:
adapter: cache.adapter.apcu
doctrine.system_cache_pool:
adapter: cache.adapter.apcu
以上配置取自here.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)