You are here

protected function DeveloperCache::prepareCacheItem in Apigee Edge 8

Generates cache items for an entity.

The cache id returned here must be always unique!

Parameters

\Apigee\Edge\Entity\EntityInterface $entity: The entity object that gets cached.

Return value

array Array of cache items. An array that CacheBackendInterface::setMultiple() can accept.

Overrides EntityCache::prepareCacheItem

See also

\Drupal\Core\Cache\CacheBackendInterface::setMultiple()

File

src/Entity/Controller/Cache/DeveloperCache.php, line 59

Class

DeveloperCache
Default developer cache implementation.

Namespace

Drupal\apigee_edge\Entity\Controller\Cache

Code

protected function prepareCacheItem(EntityInterface $entity) : array {

  /** @var \Apigee\Edge\Api\Management\Entity\DeveloperInterface $entity */
  $item = parent::prepareCacheItem($entity);

  // Add developer's email as tag to generated cache items by the parent
  // class.
  foreach ($item as $cid => $developer) {
    $item[$cid]['tags'][] = $entity
      ->getEmail();
  }
  $this->developerIdEmailMap[$entity
    ->getDeveloperId()] = $entity
    ->getEmail();
  return $item;
}