You are here

protected function DeveloperCache::doSaveEntities in Apigee Edge 8

Allows to perform additional tasks after entities got saved to cache.

Parameters

\Apigee\Edge\Entity\EntityInterface[] $entities: Array of entities.

Overrides EntityCache::doSaveEntities

File

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

Class

DeveloperCache
Default developer cache implementation.

Namespace

Drupal\apigee_edge\Entity\Controller\Cache

Code

protected function doSaveEntities(array $entities) : void {
  parent::doSaveEntities($entities);
  $items = [];
  foreach ($entities as $entity) {

    // Add new cache item that uses developer's email address as a cid instead
    // of developer's id (UUID).
    $items[$entity
      ->getEmail()] = [
      'data' => $entity,
      'tags' => [
        $entity
          ->getDeveloperId(),
        $entity
          ->getEmail(),
      ],
    ];
  }
  $this->cacheBackend
    ->setMultiple($items);
}