isStaticallyCacheable example


  public function loadUnchanged($id) {
    $this->resetCache([$id]);
    return $this->load($id);
  }

  /** * {@inheritdoc} */
  public function resetCache(array $ids = NULL) {
    if ($this->entityType->isStaticallyCacheable() && isset($ids)) {
      foreach ($ids as $id) {
        $this->memoryCache->delete($this->buildCacheId($id));
      }
    }
    else {
      // Call the backend method directly.       $this->memoryCache->invalidateTags([$this->memoryCacheTag]);
    }
  }

  /** * Gets entities from the static cache. * * @param array $ids * If not empty, return entities that match these IDs. * * @return \Drupal\Core\Entity\EntityInterface[] * Array of entities from the entity cache, keyed by entity ID. */
Home | Imprint | This part of the site doesn't use cookies.