Score:1

drupal9 dev mode local settings : non existing cache.backend.null

za flag

In drupal9 my drupal8 local.settings.php conf generate an error when i empty cache

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have [error] requested a non-existent service "cache.backend.null". Did you mean one of these: "cache.backend.apcu", "cache.backend.memory", "cache.backend.php"? in /data-platforms/platforms/drupal9-dev/core/lib/Drupal/Component/DependencyInjection/Container.php:156

this has to do with

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

what do i have to change here for drupal9 ?

cn flag
It’s the same as for D8 - you need to be including your development.services.yml in the container ymls in settings.php and then rebuild cache
Score:3
in flag

As Clive mentioned, this is the same for D8 and D9 and cache.backend.null is defined in development.services.yml so the easiest way to use it is to add development.services.yml to your container ymls.

To do this add the following near the top of your settings file (code taken from core's default example.settings.local.php) :

/**
 * Enable local development services.
 */
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';

Additionally, example.settings.local.php tells you that you must do this to use cache.backend.null:

/**
 * Disable the render cache.
 *
 * Note: you should test with the render cache enabled, to ensure the correct
 * cacheability metadata is present. However, in the early stages of
 * development, you may want to disable it.
 *
 * This setting disables the render cache by using the Null cache back-end
 * defined by the development.services.yml file above.
 *
 * Only use this setting once the site has been installed.
 */
# $settings['cache']['bins']['render'] = 'cache.backend.null';

If, for some reason, you don't want to use the default development.services.yml file, you could instead use a custom.services.yml file as long as it includes the cache.backend.null definition.

To do this, you'd need to add the following to your settings file:

/**
 * Enable custom services.
 */
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/custom.services.yml';

And then in your sites/custom.services.yml file:

services:
  cache.backend.null:
    class: Drupal\Core\Cache\NullBackendFactory
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.