Skip to main content
Cache disable

Disable Drupal 8 cache during development

We know Drupal 8 has a heavy caching mechanism, so we need to clear cache for changes made in twig file or some other file to reflect in the site. Basically, a themer or developer won't love the caching system on the development stage. So it is better to disable cache on the development stage rather than clearing cache for every change being made.

And here are the steps to disable cache and save your valuable time:

  • Copy and rename the sites/example.settings.local.php file as sites/default/settings.local.php

cp sites/example.settings.local.php sites/default/settings.local.php
  • Open a settings.php file in sites/default directory and uncomment these lines:

if (file_exists(__DIR__ . '/settings.local.php')) {
  include __DIR__ . '/settings.local.php';
  • Uncomment the following lines in settings.local.php to disable the render cache and dynamic page cache

$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
  • Finally, open in the sites folder and add the following lines (to disable twig cache)                

    debug : true
    auto_reload: true
    cache: false
  • After the above steps, you need to rebuild the Drupal cache. Otherwise, your website will encounter an unexpected error on page reload. This can be done by run following drush comment:

drush cache-rebuild (or) drush cr
  • Finished! Now you will able to develop in Drupal 8 without manual cache rebuilds on a regular basis.

  • Detailed documentation  in Drupal 8 is available on