【问题标题】:Drupal 8 cache can't be disabled for development开发时无法禁用 Drupal 8 缓存
【发布时间】:2017-01-02 11:28:58
【问题描述】:

尽管我按照本文中的所有步骤进行操作,但我仍然需要在 Drupal 中手动清除缓存(config/development/performance)https://www.drupal.org/node/2598914

我按照启用本地开发设置

标题下的步骤操作

我使用 MAMP 并在 MAMP 设置中禁用了缓存。

【问题讨论】:

    标签: caching drupal drupal-8


    【解决方案1】:

    尝试将以下内容添加到“服务”下的 development.services.yml 中:

    cache.backend.memory:
    class: Drupal\Core\Cache\MemoryBackendFactory
    

    并将这些行添加到您的 settings.local.php:

    $config['system.performance']['css']['gzip'] = FALSE;
    $config['system.performance']['js']['gzip'] = FALSE;
    $config['system.performance']['response']['gzip'] = FALSE;
    

    【讨论】:

    • 我只看到在 Drupal 中手动缓存后的更改。我的 development.services.yml 文件现在看起来像这样:'parameters: http.response.debug_cacheability_headers: true services: cache.backend.null: class: Drupal\Core\Cache\NullBackendFactory cache.backend.memory: class: Drupal\ Core\Cache\MemoryBackendFactory 参数:twig.config: debug: true auto_reload: true cache: false'
    • 您确定 settings.local.php 包含正确吗?尝试放置一个骰子;或文件中用于测试目的的内容。
    【解决方案2】:

    问题出在我的sites/development.services.yml 文件中。 parameters: 被定义了两次。该文件应如下所示:

    # Local development services.
    #
    # To activate this feature, follow the instructions at the top of the
    # 'example.settings.local.php' file, which sits next to this file.
    services:
      cache.backend.null:
        class: Drupal\Core\Cache\NullBackendFactory
    parameters:
      twig.config:
        debug: true
        auto_reload: true
        cache: false
    

    【讨论】:

      猜你喜欢
      • 2018-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-25
      • 1970-01-01
      • 1970-01-01
      • 2016-03-07
      • 2011-02-23
      相关资源
      最近更新 更多