You are here

public function ResourceObjectNormalizationCacher::get in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php \Drupal\jsonapi\EventSubscriber\ResourceObjectNormalizationCacher::get()

Reads an entity normalization from cache.

The returned normalization may only be a partial normalization because it was previously normalized with a sparse fieldset.

Parameters

\Drupal\jsonapi\JsonApiResource\ResourceObject $object: The resource object for which to generate a cache item.

Return value

array|false The cached normalization parts, or FALSE if not yet cached.

See also

\Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber::renderArrayToResponse()

File

core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php, line 80

Class

ResourceObjectNormalizationCacher
Caches entity normalizations after the response has been sent.

Namespace

Drupal\jsonapi\EventSubscriber

Code

public function get(ResourceObject $object) {
  $cached = $this->renderCache
    ->get(static::generateLookupRenderArray($object));
  return $cached ? $cached['#data'] : FALSE;
}