【问题标题】:Doctrine result cache is not deleting in production environment in symfony2在 symfony2 的生产环境中没有删除 Doctrine 结果缓存
【发布时间】:2013-11-28 10:24:34
【问题描述】:

我在 symfony2 中使用 Doctrine 结果缓存。

仅在生产环境中,结果缓存删除不删除缓存。 但在开发环境结果缓存删除工作正常。

这是我编写的用于在教义中使用结果缓存的代码。

//code to store result cache in doctrin. 
$qb->useResultCache(true);
$qb->setResultCacheId('key');    

//code to delete result cache when db data edit.

$em->getConfiguration()->getResultCacheImpl()->delete('key');

这里的问题在于 symfony2 中的生产环境。

生产环境有什么特殊的学说缓存配置吗?

请帮我解决这个问题。

【问题讨论】:

    标签: php symfony caching doctrine-orm memcached


    【解决方案1】:

    它不应该是生产环境的任何特殊标志。 Doctrine 甚至不关心环境,尤其是在内核初始化时设置的 Symfony2 东西,例如:

    #web/app.php
    ...
    $kernel = new AppKernel('prod', false); 
    

    也许先检查一下:

    echo $this->container->get('kernel')->getEnvironment();
    

    100% 确定您处于“生产”环境中。

    如果你是的话,你可以试试:

    $em->getConfiguration()->getResultCacheImpl()->deleteAll();
    

    检查它是否会删除环境的所有缓存,以便您知道这是 delete('key') 方法的特定问题还是其他问题。

    【讨论】:

    • 我检查了环境,它只是“prod”,并试图删除所有缓存,但它仍然没有在生产环境中删除。
    猜你喜欢
    • 1970-01-01
    • 2010-09-16
    • 2013-03-11
    • 1970-01-01
    • 2021-11-10
    • 2016-05-19
    • 1970-01-01
    • 1970-01-01
    • 2012-02-14
    相关资源
    最近更新 更多