Use per-bundle entity list cache tags to potentially increase caching and performance in jsonapi

Created on 25 October 2019, about 5 years ago
Updated 24 May 2023, over 1 year ago

Problem/Motivation

As an example, you have the node entity type with three bundles: article, blog, and page.

JSON API provides three API resources for those: jsonapi/node/article, jsonapi/node/blog and jsonapi/node/page.

The entity list cache tag for node, node_list, will automatically be added to each of those responses but I think it's wasteful. Any operation on an article node will clear caches for blog and page. There's no need for that.

Proposed resolution

Stop adding the entity type's list cache tag to responses. Rather, use the tag that takes the bundle in to account, ie, {entity_type_id}_list:{bundle}.

Remaining tasks

  • Decide if this is a good idea and worth doing.
  • Evaluation any potential downsides such as other list cache tags not making it in the the response that may be required.
  • Write a patch.
πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component
JSON APIΒ  β†’

Last updated 3 days ago

Created by

πŸ‡ΊπŸ‡ΈUnited States mstef

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024