【问题标题】:Symfony Doctrine APCu cache not clearing, "apcu_store" returning falseSymfony Doctrine APCu 缓存未清除,“apcu_store”返回 false
【发布时间】:2020-08-15 12:42:34
【问题描述】:

我的 PHP 版本是 7.4.3,并且 APCu 扩展也已配置和启用。我在 Symfony 4 应用程序中使用 Doctrine APCu 缓存。现在,每当我尝试清除 resultquerymetadata 缓存时,都会出现以下错误。

php bin/console doctrine:cache:clear-result

// Clearing all Result cache entries                                                                                                                                                            
[ERROR] No cache entries were deleted.                                                                                 

问题仅适用于 Symfony 应用程序。在核心 PHP apcu_store 工作正常。 apcu_store 在我的本地主机上返回 false 仅适用于 Symfony 应用程序。

以下是我的学说配置文件

doctrine.yaml

doctrine:
    orm:
        metadata_cache_driver: apcu
        query_cache_driver: apcu
        result_cache_driver: apcu   
        .....

相同的代码在我的生产中运行,但在我的本地没有。结果未清除。

【问题讨论】:

    标签: php symfony doctrine-orm symfony4 apcu


    【解决方案1】:

    我不是 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 的结果,但它应该可以工作......

    也许您可以通过一些示例提供有关您的配置的更多信息。

    干杯。

    【讨论】:

      猜你喜欢
      • 2018-06-01
      • 2018-05-26
      • 2014-10-23
      • 1970-01-01
      • 2017-12-21
      • 2013-03-26
      • 2014-11-13
      • 1970-01-01
      • 2013-03-11
      相关资源
      最近更新 更多