Don*_*ndi 1 php caching redis symfony doctrine-orm
听起来很简单,但它让我连续几个小时.
如何使用密码连接到redis缓存服务器.它在没有密码的情况下成功连接和缓存了学说查询,但是当我输入密码时,它会抛出异常
InvalidConfigurationException in ArrayNode.php line 309:
Unrecognized option "password" under "doctrine.orm.entity_managers.default.query_cache_driver"
Run Code Online (Sandbox Code Playgroud)
我尝试了一个组合,但我目前的代码是config.yml .....
entity_managers:
default:
metadata_cache_driver: apc
query_cache_driver:
type: redis
host: localhost
port: 6379
# password: myStr0nG!passw0rd - adding this causes exception
instance_class: Redis
result_cache_driver:
type: redis
host: localhost
port: 6379
# password: myStr0nG!passw0rd - adding this causes exception
instance_class: Redis
Run Code Online (Sandbox Code Playgroud)
您不能为缓存驱动程序设置密码,因为它不受支持.
如果您想要替代方案,请考虑使用SncRedisBundle
配置示例
snc_redis:
clients:
cache:
type: predis
alias: default
dsn: redis://secret@localhost/1
logging: %kernel.debug%
doctrine:
metadata_cache:
client: cache
entity_manager: default # the name of your entity_manager connection
document_manager: default # the name of your document_manager connection
result_cache:
client: cache
entity_manager: [default, read] # you may specify multiple entity_managers
query_cache:
client: cache
entity_manager: default
Run Code Online (Sandbox Code Playgroud)