You are here

protected function DeveloperAppStorage::getCacheTagsByOwner in Apigee Edge 8

Returns app owner related cache tags for an app.

These cache tags gets added to the generated app cache entry which ensures when app's owner gets deleted the related app cache entries gets invalidated as well.

Parameters

\Drupal\apigee_edge\Entity\AppInterface $app: The app entity.

Return value

array Array of app owner related cache entries.

Overrides AppStorage::getCacheTagsByOwner

See also

getPersistentCacheTags()

getPersistentCacheTagsForAppName()

File

src/Entity/Storage/DeveloperAppStorage.php, line 125

Class

DeveloperAppStorage
Entity storage class for Developer app entities.

Namespace

Drupal\apigee_edge\Entity\Storage

Code

protected function getCacheTagsByOwner(AppInterface $app) : array {

  // Add developer's UUID to ensure when the owner of the app (developer)
  // gets deleted then _all_ its cached developer app data gets purged along
  // with it.
  $cache_tags = [
    "developer:{$app->getAppOwner()}",
  ];

  /** @var \Drupal\apigee_edge\Entity\DeveloperAppInterface $app */

  // Add the owner of the app (Drupal user id) to ensure when the Drupal user
  // gets deleted then _all_ its cached developer app data gets purged along
  // with it. (The additional cache tag by developer id should be enough
  // though.)
  // Note: This also invalidates cached app data when a user gets updated
  // which might be even beneficial for us. Create a custom solution if this
  // default behavior becomes a bottleneck.
  if ($app
    ->getOwnerId()) {
    $cache_tags[] = "user:{$app->getOwnerId()}";
  }
  return $cache_tags;
}