Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. BlockContentUuidLookup.php

function 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_content

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal