function BlockContentUuidLookup::resolveCacheMiss
Same name in other branches
- 9 core/modules/block_content/src/BlockContentUuidLookup.php \Drupal\block_content\BlockContentUuidLookup::resolveCacheMiss()
- 8.9.x core/modules/block_content/src/BlockContentUuidLookup.php \Drupal\block_content\BlockContentUuidLookup::resolveCacheMiss()
- 10 core/modules/block_content/src/BlockContentUuidLookup.php \Drupal\block_content\BlockContentUuidLookup::resolveCacheMiss()
Overrides CacheCollector::resolveCacheMiss
File
-
core/
modules/ block_content/ src/ BlockContentUuidLookup.php, line 48
Class
- BlockContentUuidLookup
- A cache collector that caches IDs for block_content UUIDs.
Namespace
Drupal\block_contentCode
protected function resolveCacheMiss($key) {
$ids = $this->entityTypeManager
->getStorage('block_content')
->getQuery()
->accessCheck(FALSE)
->condition('uuid', $key)
->execute();
// Only cache if there is a match, otherwise creating new entities would
// require to invalidate the cache.
$id = reset($ids);
if ($id) {
$this->storage[$key] = $id;
$this->persist($key);
}
return $id;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.