You are here

public function EntityTypeManager::useCaches in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/EntityTypeManager.php \Drupal\Core\Entity\EntityTypeManager::useCaches()

Disable the use of caches.

Can be used to ensure that uncached plugin definitions are returned, without invalidating all cached information.

This will also remove all local/static caches.

Parameters

bool $use_caches: FALSE to not use any caches.

Overrides DefaultPluginManager::useCaches

File

core/lib/Drupal/Core/Entity/EntityTypeManager.php, line 173

Class

EntityTypeManager
Manages entity type plugin definitions.

Namespace

Drupal\Core\Entity

Code

public function useCaches($use_caches = FALSE) {
  parent::useCaches($use_caches);
  if (!$use_caches) {
    $this->handlers = [];
    $this->container
      ->get('entity.memory_cache')
      ->reset();
  }
}