You are here

protected function DeveloperStorage::setPersistentCache in Apigee Edge 8

Stores entities in the persistent cache backend.

Parameters

\Drupal\Core\Entity\EntityInterface[] $entities: Entities to store in the cache.

Overrides EdgeEntityStorageBase::setPersistentCache

File

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

Class

DeveloperStorage
Entity storage implementation for developers.

Namespace

Drupal\apigee_edge\Entity\Storage

Code

protected function setPersistentCache(array $entities) {
  parent::setPersistentCache($entities);
  if (!$this->entityType
    ->isPersistentlyCacheable()) {
    return;
  }

  // Create a separate cache entry that uses developer id in the cache id
  // instead of the email address. This way we can load a developer from
  // cache by using both ids.
  foreach ($entities as $entity) {

    /** @var \Drupal\apigee_edge\Entity\Developer $entity */
    $this->cacheBackend
      ->set($this
      ->buildCacheId($entity
      ->getDeveloperId()), $entity, $this
      ->getPersistentCacheExpiration(), $this
      ->getPersistentCacheTags($entity));
  }
}