php - Symfony Doctrine APCu cache not clearing, "apcu_store" returning false
问题描述
My PHP version is 7.4.3 and APCu extension is also configured and enabled. I'm using Doctrine APCu cache in my Symfony 4 application. Now whenever I try to clear the result
or query
or metadata
cache I got following error.
php bin/console doctrine:cache:clear-result
// Clearing all Result cache entries
[ERROR] No cache entries were deleted.
Issue is only for Symfony App. In core PHP apcu_store
is working fine. apcu_store
returning false on my localhost for Symfony app only.
Below is my doctrine config file
doctrine.yaml
doctrine:
orm:
metadata_cache_driver: apcu
query_cache_driver: apcu
result_cache_driver: apcu
.....
Same code is working on my production but not on my local. Result not clearing.
解决方案
我不是 Symfony 的专家,但也许如果没有缓存条目被删除,Symfony 就没有使用它。 https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/caching.html
<?php
$query = $em->createQuery('select u from \Entities\User u');
$query->useResultCache(true);
您确定要在清除结果之前保存结果吗?从来没有使用 apcu 来获得结果,但它应该可以工作......
也许您可以通过一些示例提供有关您的配置的其他信息。
干杯。
推荐阅读
- php - 更改 WordPress 后端布局(删除某些选项卡)
- python - 使用字符串格式的 DataFrame 索引作为类的实例
- r - 如何从列中创建二进制虚拟变量?
- c# - 聊天机器人从后面的代码更新任务模块
- vue.js - vuejs编辑表单模态不断更新父
- arrays - (如何)可以在 Swift 中交换两个大小和类型相同的整个数组吗?
- flutter - 如何从颤动的手机中找到与电子邮件相关联的所有电子邮件地址?
- vba - 如何在 Microsoft Access 中刷新子窗体的内容?
- javascript - React Bootstrap - 'openModal' 未定义 no-undef
- json - 获取本地 JSON 返回未定义