function EntityStorageBase::setStaticCache
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::setStaticCache()
- 8.9.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::setStaticCache()
- 11.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::setStaticCache()
Stores entities in the static entity cache.
Parameters
\Drupal\Core\Entity\EntityInterface[] $entities: Entities to store in the cache.
2 calls to EntityStorageBase::setStaticCache()
- ContentEntityStorageBase::loadUnchanged in core/
lib/ Drupal/ Core/ Entity/ ContentEntityStorageBase.php - Loads an unchanged entity from the database.
- EntityStorageBase::loadMultiple in core/
lib/ Drupal/ Core/ Entity/ EntityStorageBase.php - Loads one or more entities.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityStorageBase.php, line 196
Class
- EntityStorageBase
- A base entity storage class.
Namespace
Drupal\Core\EntityCode
protected function setStaticCache(array $entities) {
if ($this->entityType
->isStaticallyCacheable()) {
foreach ($entities as $entity) {
$this->memoryCache
->set($this->buildCacheId($entity->id()), $entity, MemoryCacheInterface::CACHE_PERMANENT, [
$this->memoryCacheTag,
]);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.