function ResourceObjectNormalizationCacher::generateCacheKeys

Same name in other branches
  1. 11.x core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php \Drupal\jsonapi\EventSubscriber\ResourceObjectNormalizationCacher::generateCacheKeys()

Generates the cache keys for a normalization.

Parameters

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

Return value

string[] The cache keys to pass to the variation cache.

See also

\Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber::$dynamicPageCacheRedirectRenderArray

2 calls to ResourceObjectNormalizationCacher::generateCacheKeys()
ResourceObjectNormalizationCacher::get in core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php
Reads an entity normalization from cache.
ResourceObjectNormalizationCacher::set in core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php
Writes a normalization to cache.

File

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

Class

ResourceObjectNormalizationCacher
Caches entity normalizations after the response has been sent.

Namespace

Drupal\jsonapi\EventSubscriber

Code

protected static function generateCacheKeys(ResourceObject $object) {
    return [
        $object->getResourceType()
            ->getTypeName(),
        $object->getId(),
        $object->getLanguage()
            ->getId(),
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.