setPersistentCache example

/** * {@inheritdoc} */
  protected function doLoadMultiple(array $ids = NULL) {
    // Attempt to load entities from the persistent cache. This will remove IDs     // that were loaded from $ids.     $entities_from_cache = $this->getFromPersistentCache($ids);

    // Load any remaining entities from the database.     if ($entities_from_storage = $this->getFromStorage($ids)) {
      $this->invokeStorageLoadHook($entities_from_storage);
      $this->setPersistentCache($entities_from_storage);
    }

    return $entities_from_cache + $entities_from_storage;
  }

  /** * Gets entities from the storage. * * @param array|null $ids * If not empty, return entities that match these IDs. Return all entities * when NULL. * * @return \Drupal\Core\Entity\ContentEntityInterface[] * Array of entities from the storage. */
Home | Imprint | This part of the site doesn't use cookies.