Why cache.backend.null does not find from the settings.php file?

Why cache.backend.null does not find from the settings.php file?

Why cache.backend.null does not find when using in settings.php file?

Why cache.backend.null does not find when using in settings.php file?

For local debugging the Drupal 8 website you might have configured the cache bins to be nulled so your site doesn’t get cached and you can debug the site easily

Why this happens?

Drupal backend caches(render cache, dynamic_page_cache, page

) by default stores the cache in backend using the backend classes respectively. These backends can be in memory, APCU, or PHP or any custom backend like the below-mentioned.

  • Cache.backend.memory  
  • Cache.backend.apcu 
  • Cache.backend.php

When you put this configuration in settings.php file -

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

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

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

You have defined which backend cache bin each of the above definitions should hit to store and retrieve of the cache data. And in Drupal 8 you also need to define the class for the cache backend in  development.services.yml file just to define the backend class for the services. 

 

services:

 cache.backend.null:

   class: Drupal\Core\Cache\NullBackendFactory

 

The NullBackendFactory does not store the data anywhere and you do not need to perform cache rebuild every time. NullBackendFactor invokes the NullBackend which stub the cache implementation.