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