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:
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.
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.
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() .
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With