You are here

public function EdgeEntityStorageBase::resetCache in Apigee Edge 8

Resets the internal, static entity cache.

Parameters

$ids: (optional) If specified, the cache is reset for the entities with the given ids only.

Overrides EntityStorageBase::resetCache

2 calls to EdgeEntityStorageBase::resetCache()
AppStorage::resetCache in src/Entity/Storage/AppStorage.php
Resets the internal, static entity cache.
DeveloperStorage::resetCache in src/Entity/Storage/DeveloperStorage.php
Resets the internal, static entity cache.
2 methods override EdgeEntityStorageBase::resetCache()
AppStorage::resetCache in src/Entity/Storage/AppStorage.php
Resets the internal, static entity cache.
DeveloperStorage::resetCache in src/Entity/Storage/DeveloperStorage.php
Resets the internal, static entity cache.

File

src/Entity/Storage/EdgeEntityStorageBase.php, line 452

Class

EdgeEntityStorageBase
Base entity storage class for Apigee Edge entities.

Namespace

Drupal\apigee_edge\Entity\Storage

Code

public function resetCache(array $ids = NULL) {
  if ($this->entityType
    ->isStaticallyCacheable() && $ids) {
    $cids = [];
    foreach ($ids as $id) {
      $cid = $this
        ->buildCacheId($id);
      $cids[] = $cid;
      $this->memoryCache
        ->delete($cid);
    }
    if ($this->entityType
      ->isPersistentlyCacheable()) {
      $this->cacheBackend
        ->deleteMultiple($cids);
    }
  }
  else {
    $this->memoryCache
      ->invalidateTags([
      $this->memoryCacheTag,
    ]);
    if ($this->entityType
      ->isPersistentlyCacheable()) {
      Cache::invalidateTags([
        $this->entityTypeId . ':values',
      ]);
    }
  }

  // We do not clear the entity controller's cache here because our main goal
  // with the entity controller cache to reduce the API calls that we
  // send to Apigee Edge. Although we do delete the entity controller's cache
  // when it is necessary, like in loadUnchanged().
}