You are here

protected function DeveloperStorage::getPersistentCacheTags in Apigee Edge 8

Generates cache tags for entities.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: An entity object.

Return value

array Array of cache tags.

Overrides EdgeEntityStorageBase::getPersistentCacheTags

1 call to DeveloperStorage::getPersistentCacheTags()
DeveloperStorage::setPersistentCache in src/Entity/Storage/DeveloperStorage.php
Stores entities in the persistent cache backend.

File

src/Entity/Storage/DeveloperStorage.php, line 175

Class

DeveloperStorage
Entity storage implementation for developers.

Namespace

Drupal\apigee_edge\Entity\Storage

Code

protected function getPersistentCacheTags(EntityInterface $entity) {

  /** @var \Drupal\apigee_edge\Entity\Developer $entity */
  $cache_tags = parent::getPersistentCacheTags($entity);
  $cache_tags = $this
    ->sanitizeCacheTags($entity
    ->id(), $cache_tags);

  // Create tags by developerId (besides email address).
  $cache_tags[] = "{$this->entityTypeId}:{$entity->uuid()}";
  $cache_tags[] = "{$this->entityTypeId}:{$entity->uuid()}:values";

  // Also add a tag by developer's Drupal user id to ensure that cached
  // developer data is invalidated when the related Drupal user gets changed
  // or deleted.
  if ($entity
    ->getOwnerId()) {
    $cache_tags[] = "user:{$entity->getOwnerId()}";
  }
  return $cache_tags;
}