Improvements to the Uncacheable functionality

Created on 19 June 2020, almost 5 years ago
Updated 26 September 2024, 7 months ago

Problem/Motivation

Following on from discussion started on Cache issue persists after update to 8.x-2.0-alpha2 🐛 Cache issue persists after update to 8.x-2.0-alpha2 Closed: outdated it was decided the below considerations should be moved to a new issue.

  • Do we need to ensure the correct cache settings are applied on entity type updates? Is there a chance the field_encrypt cache overrides could be reverted in the last installed definition resulting in entities we don't want cached being cached again.
  • ConfigSubscriber::setUncacheableEntityTypes() currently does a check of all entity types which doesn't seem very efficient. Consider refactoring this method to only operate on the entity type containing the field that has had its configuration saved.
  • Consider consolidating the Uncacheable functionality into its own service.

Proposed resolution

  1. If it is determined there is a risk of field_encrypt cache overrides being reverted, add an Entity Type listener to act on entity type definition updates.
  2. Introduce a EntityTypeCacheableManager service (for lack of a better name) to consolidate the entity type cache property related logic.
  3. Refactor field_encrypt_entity_type_alter() to use the EntityTypeCacheableManager service
  4. Refactor\Drupal\field_encrypt\EventSubscriber\ConfigSubscriber::setUncacheableEntityTypes() to use the EntityTypeCacheableManager service and only affect the entity type containing the field who's configuration was updated.

Remaining tasks

  1. Determine which items of the proposed resolutions are worth pursuing.
  2. Modify existing patch/create new patch based on the agreed approach.

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Closed: outdated

Version

2.0

Component

Code

Created by

🇨🇦Canada tame4tex

Live updates comments and jobs are added and updated live.
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