protected function ContentEntityStorageBase::setPersistentCache

protected ContentEntityStorageBase::setPersistentCache($entities)

Stores entities in the persistent cache backend.

Parameters

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

File

core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php, line 606

Class

ContentEntityStorageBase
Base class for content entity storage handlers.

Namespace

Drupal\Core\Entity

Code

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

  $cache_tags = array(
    $this->entityTypeId . '_values',
    'entity_field_info',
  );
  foreach ($entities as $id => $entity) {
    $this->cacheBackend->set($this->buildCacheId($id), $entity, CacheBackendInterface::CACHE_PERMANENT, $cache_tags);
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!ContentEntityStorageBase.php/function/ContentEntityStorageBase::setPersistentCache/8.1.x