ResourceObjectNormalizationCacher
class ResourceObjectNormalizationCacher implements EventSubscriberInterface (View source)
| internal |
Caches entity normalizations after the response has been sent.
Constants
| RESOURCE_CACHE_SUBSET_BASE |
Key for the base subset. The base subset contains the parts of the normalization that are always present. The presence or absence of these are not affected by the requested sparse field sets. This typically includes the resource type name, and the resource ID. |
| RESOURCE_CACHE_SUBSET_FIELDS |
Key for the fields subset. The fields subset contains the parts of the normalization that can appear in a normalization based on the selected field set. This subset is incrementally built across different requests for the same resource object. A given field is normalized and put into the cache whenever there is a cache miss for that field. |
Properties
| protected RenderCacheInterface | $renderCache | The render cache. |
|
| protected array | $toCache | The things to cache after the response has been sent. |
Methods
Adds a normalization to be cached after the response has been sent.
Writes normalizations of entities to cache, if any were created.
Generates a lookup render array for a normalization.
{@inheritdoc}
Determines the joint cacheability of all provided dependencies.
Details
setRenderCache(RenderCacheInterface $render_cache)
Sets the render cache service.
array|false
get(ResourceObject $object)
Reads an entity normalization from cache.
The returned normalization may only be a partial normalization because it was previously normalized with a sparse fieldset.
saveOnTerminate(ResourceObject $object, array $normalization_parts)
Adds a normalization to be cached after the response has been sent.
onTerminate(TerminateEvent $event)
Writes normalizations of entities to cache, if any were created.
protected
set(ResourceObject $object, array $normalization_parts)
Writes a normalization to cache.
static protected array
generateLookupRenderArray(ResourceObject $object)
Generates a lookup render array for a normalization.
static
getSubscribedEvents()
{@inheritdoc}
static protected CacheableMetadata
mergeCacheableDependencies(array $dependencies)
Determines the joint cacheability of all provided dependencies.