Do not delete saved data after clearing the cache

Created on 2 May 2023, about 1 year ago
Updated 31 August 2023, 10 months ago

Problem/Motivation

Currently the saved domain data is stored in the cache, which means that all domain data saved to cache is deleted after clearing the cache using drush cr or in UI. This can cause inconvenience to users who rely on this data for their site's functionality.

Steps to reproduce

  1. Perform any action for saving data to domain cache
  2. Clear the cache using drush cr or in UI.
  3. Check if the saved domain data still exists.

Proposed resolution

To address this issue, a good option would be to give users the possibility to choose where to store domain data. This can be achieved by implementing a plugin system for data storage and creating two plugins: cache and states.

The cache plugin would store data in Drupal's cache system, as it currently does. The states plugin would store data in Drupal's state system, which persists data across cache clears.

By implementing a plugin system, users can choose which plugin to use for storing their domain data, based on their needs.

Remaining tasks

The following tasks need to be completed to implement this feature:

  • Implement the plugin system for data storage.
  • Create the cache plugin and states plugin.
  • Allow users to choose which plugin to use for storing domain data.
  • Update the documentation to reflect this new feature.

User interface changes

The user interface will need to be updated to allow users to choose which plugin to use for storing domain data. This can be achieved by adding a new setting in the DRD configuration form.

✨ Feature request
Status

Active

Version

4.1

Component

Code

Created by

🇷🇺Russia qzmenko Novosibirsk

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

Comments & Activities

  • Issue created by @qzmenko
  • 🇷🇺Russia qzmenko Novosibirsk
  • 🇩🇪Germany jurgenhaas Gottmadingen

    This is a good point, thanks for bringing this up @qzmenko. However, let me express some concerns too, and why we've originally implemented the way it is now: the domain data is a static copy of important information from a remote site. And it doesn't update itself automatically, it requires the drd:info action to be executed. If that's not done regularly, the domain data will be outdated.

    Wrong data is worse than no data!

    As you already stated, users do rely on the data they see in DRD. That's why we need to find a fine balance for how long we keep the collected data from remote vs. performance to not collect the data from remote too often.

    That's why we used the cache backend for storage so that the data is kept there for a fairly short period of time.

    As an alternative solution to the original proposal, how about implementing a configurable cache life-time for the domain data with a default of what we currently have. And in addition to that, if anything wants to access domain data which is either not present or outdated, DRD could execute drd:info automatically, to then collect the remote data as needed.

  • 🇮🇳India zeshan.ziya

    Yes @jurgenhaas, Implementing the use of a configurable cache lifetime seems to be a worthwhile consideration. Furthermore, I'd like to propose the inclusion of a timestamp that displays the data's last retrieval time. This enhancement would provide users with insight into the recency of the present data.

Production build 0.69.0 2024