首页>Magento>source

在我们的一个项目网站开始加载非常慢,我发现所有缓存都已禁用,我之前已启用.

我可以找出以下哪些方法可以禁用缓存:

  • When someone runs php bin/magento cache:disable   命令。
  • 当有人修改 app/etc/env.php时   并从那里禁用缓存。
  • 在某些情况下,文件.regenerate写入var文件夹(在安装升级或编译器安装/升级时),如果在运行 php bin/magento setup:di:compile时存在该文件   在编译过程完成时禁用并重新启用缓存.出于某种原因,有时不会重新启用缓存. (参考此处
的其他可能性是什么?
  • Someone having code/db access can disable it ?
  • Automatically it can get disabled ?
最新回答
  • 2019-12-5
    1 #

    在开发人员模式下,后端选项可用于禁用后端的任何缓存

    在生产模式中,此选项不可用,因此您需要通过命令执行此操作。

    要禁用所有缓存,您需要运行此缓存,因为您已经添加了问题:

    php bin/magento cache:disable
    

    如果您需要在缓存上禁用,请通过其标记名称

    禁用它

    实施例:结果

    magento cache:disable full_page
    

    这些缓存类型没有数据库条目,如果从命令禁用任何缓存,那么它将更新 env.php中的条目 ,如果你从管理员那里做,那么这个方法也将更新 env.php中的条目

    您将找不到任何其他方法来禁用缓存.你可以禁用它 from shell   或者 from admin   或直接 from env.php

    希望这是你问题的答案。

  • 2019-12-5
    2 #

    这是Magento 2.2中的已知问题:https://github.com/magento/magento2/issues/17634

    In this path: magento2/lib/internal/Magento/Framework/Code/GeneratedFiles.php .    这是除了您的场景之外禁用缓存的代码    在你的答案中提到

    $deploymentConfig = $this->directoryList->getPath(DirectoryList::CONFIG);
                $configPool = new ConfigFilePool();
                $envPath = $deploymentConfig . '/' . $configPool->getPath(ConfigFilePool::APP_ENV);
                if ($this->write->isExist($this->write->getRelativePath($envPath))) {
                    $enabledCacheTypes = $this->getEnabledCacheTypes();
                    $this->disableAllCacheTypes();
                }
    

    I hope this will help

  • magento 1.9:如何在列表页面中更改面包屑的位置?
  • magento2:迁移后未保存客户属性