我正在使用Symfony 3.4 + Doctrine + Redis,通过使用Composer Bundle sncRedisBundle。
在我的config.yml中,我启用了Doctrine查询缓存:
orm:
default_entity_manager: default
entity_managers:
default:
connection: default
auto_mapping: false
metadata_cache_driver: redis
query_cache_driver: redis
result_cache_driver: redis # !!!
snc_redis:
clients:
doctrine:
type: predis
alias: doctrine_redis
dsn: "%redis_dsn_doctrine%"
logging: false
options:
connection_persistent: true
doctrine:
query_cache: #!!!!!!!!
#it caches the translation from Doctrine's DQL into SQL.
client: doctrine_redis
namespace: shop_doctrine_query
entity_manager: [default, legacy]
Doctrine为其 result_cache
设置的键永不过期:
我该如何自动调用 \Doctrine\ORM\Query::setQueryCacheLifetime
,或使缓存失效?(注意,我无法在此服务器上设置redis清除策略。)
config/packages/*/cache.yaml
文件和symfony console cache:pool:list
的返回结果吗? - Alexandre Tranchant