Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable entire cache for development

I'm developing a new theme for Drupal 8. I need to disable all caching mechanisms in Drupal. I found the configuration for twig caching and CSS/JavaScript but not for other things of Drupal (like .theme files, etc.).

I found some hints here:

  • https://api.drupal.org/api/drupal/core!core.services.yml/8
  • https://www.drupal.org/node/2239909

In the first linkt you find some entries beginning with cache. and in the second link how to deactivate probably the backend cache?

Although if I paste those two lines:

$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
$settings['cache']['bins']['render'] = 'cache.backend.null';

into my settings.php Drupal shows a message that there has been an error with the page.

like image 618
TiMESPLiNTER Avatar asked Oct 31 '14 14:10

TiMESPLiNTER


People also ask

What does disable cache do in developer tools?

Along the top of the network panel, there's a checkbox that says “Disable Caching.” This disables browser-level caching, but only as long as the DevTools are open. So it won't affect your normal browsing, but while working with the developer tools you won't have to worry about stale content.

How do I disable cache in API?

Just use the Cache-Control: no-cache header. Implement it as delegating-Handler and make sure your header is applied (with MS Owin Implementation hook up on OnSendingHeaders() .

How do I force a browser to not cache?

But you can bypass the cache and force a complete refresh by using some simple hotkeys: Windows and Linux browsers: CTRL + F5. Apple Safari: SHIFT + Reload toolbar button. Chrome and Firefox for Mac: CMD + SHIFT + R.


1 Answers

to disable entire cache (twig + Drupal cache) :

first copy and rename the sites/example.settings.local.php to be sites/default/settings.local.php

$ cp sites/example.settings.local.php sites/default/settings.local.php

then open settings.php file in sites/default and uncomment these lines:

# if (file_exists(__DIR__ . '/settings.local.php')) {
#   include __DIR__ . '/settings.local.php';
# }

now open settings.local.php and change the to be TRUE

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

and uncomment all these to Disable the render cache and Disable Dynamic Page Cache

# $settings['cache']['bins']['render'] = 'cache.backend.null';
# $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

for twig cache open development.services.yml and add

parameters:
  twig.config:
    debug : true
    auto_reload: true
    cache: false

for more info https://www.drupal.org/node/2598914

like image 169
drpl Avatar answered Oct 01 '22 01:10

drpl