You are here

public function AppStorage::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 EdgeEntityStorageBase::resetCache

File

src/Entity/Storage/AppStorage.php, line 211

Class

AppStorage
Base entity storage class for developer and team (company) app entities.

Namespace

Drupal\apigee_edge\Entity\Storage

Code

public function resetCache(array $ids = NULL) {
  parent::resetCache($ids);
  if ($this->entityType
    ->isStaticallyCacheable() && $ids) {
    $tags = [];
    foreach ($ids as $id) {
      $tags[] = "{$this->entityTypeId}:{$id}:app_name";
    }
    if ($this->entityType
      ->isPersistentlyCacheable()) {
      Cache::invalidateTags($tags);
    }
  }
  else {
    if ($this->entityType
      ->isPersistentlyCacheable()) {
      Cache::invalidateTags([
        $this->entityTypeId . ':app_names',
      ]);
    }
  }

  // We do not reset the app cache because app controllers handles the
  // cache invalidation.
  // We tried to call it once here, but then we had some trouble with app
  // creation. After an app has been created in doSave() doPostSave() called
  // this method. Because we cleared to controller's app cache the
  // DeveloperAppCreateForm::save() could not load the credential form the
  // app. (Of course, we do not want to re-load the app just because of this.)
  // @see \Drupal\apigee_edge\Entity\Form\DeveloperAppCreateForm::save()
}