You are here

final public function EntityCache::saveEntities in Apigee Edge 8

Saves entities to the cache.

Parameters

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

Overrides EntityCacheInterface::saveEntities

File

src/Entity/Controller/Cache/EntityCache.php, line 84

Class

EntityCache
Default entity cache implementation for controllers.

Namespace

Drupal\apigee_edge\Entity\Controller\Cache

Code

public final function saveEntities(array $entities) : void {
  $items = [];
  foreach ($entities as $entity) {
    $primary_cache_item = $this
      ->prepareCacheItem($entity);
    $primary_cache_cids = array_keys($primary_cache_item);
    $primary_cache_cid = reset($primary_cache_cids);
    $this->cacheIds[$primary_cache_cid] = $primary_cache_cid;
    $items += $primary_cache_item;
  }
  $this->cacheBackend
    ->setMultiple($items);
  $this->entityIdCache
    ->saveEntities($entities);
  $this
    ->doSaveEntities($entities);
}