AutoSaveManager should still cache empty auto-save entities

Created on 6 August 2025, 2 days ago

Overview

AutoSaveManager leverages static caching. But it chooses not to cache empty auto-saves in \Drupal\experience_builder\AutoSave\AutoSaveManager::getAutoSaveEntity. For my layout API request this resulted in 90x database queries for the temp store.

Caching empty auto-save reduced it to 21x.

Before:

90x	27.2 ms	select ... from key_value_expire where ? > :now and ? in (:keys__0) and ? = :collection

After:

21x	6.26 ms	select ... from key_value_expire where ? > :now and ? in (:keys__0) and ? = :collection

Proposed resolution

    if (\is_null($auto_save_data)) {
      $auto_save_entity = AutoSaveEntity::empty();
      $this->cache->set($key, $auto_save_entity, tags: [self::CACHE_TAG]);
      return $auto_save_entity;
    }

User interface changes

✨ Feature request
Status

Active

Version

1.0

Component

… to be triaged

Created by

🇺🇸United States mglaman WI, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024