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

Created on 25 October 2019, over 4 years ago
Updated 24 May 2023, about 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 1 day 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.69.0 2024