You are here

final public function EntityCache::removeEntities in Apigee Edge 8

Removes entities from the cache by their ids.

Parameters

string[] $ids: Array of entity ids.

Overrides EntityCacheInterface::removeEntities

1 call to EntityCache::removeEntities()
AppCache::removeAppsByOwner in src/Entity/Controller/Cache/AppCache.php
Remove all apps from the cache by their owner.

File

src/Entity/Controller/Cache/EntityCache.php, line 109

Class

EntityCache
Default entity cache implementation for controllers.

Namespace

Drupal\apigee_edge\Entity\Controller\Cache

Code

public final function removeEntities(array $ids) : void {

  // Remove invalid ids because they cause PHP warnings/notices.
  // @see https://www.drupal.org/project/drupal/issues/3017753
  $sanitized_ids = array_intersect($ids, $this->cacheIds);
  $this->cacheIds = array_diff_key($this->cacheIds, array_flip($sanitized_ids));

  // If cacheIds is empty now, reset the state. Cache can be marked as
  // "complete" still by calling the setter method if needed.
  if (empty($this->cacheIds)) {
    $this->allEntitiesInCache = FALSE;
  }
  $this->cacheBackend
    ->invalidateMultiple($sanitized_ids);
  $this->entityIdCache
    ->removeIds($sanitized_ids);

  // Pass the original ids instead of the sanitized ones to child classes.
  // Because an id was not valid in this context it could be valid in that
  // context.
  $this
    ->doRemoveEntities($ids);
}