Problem/Motivation

Currently, the module fetches data from the API and caches it in Drupal's cache. In ideal conditions, it actively refreshes the cached data from the API every 24 hours. However, cache rebuilds can occur much more frequently than every 24 hours (deployments) and data will then need to be refreshed from the API when otherwise it would have not been necessary.

Proposed resolution

  1. Instead of just throwing the data into Drupal's cache, also write it to disk in some form (serialized JSON, YAML, ??, etc.) or use Drupal's state system.
  2. Update the set method to get the data from the API, write the data to a file, and then add it to the Drupal cache.
  3. Update the get method to first check the Drupal cache (fast), then check for the "file cache" (slower), then refresh the data from the API (slowest).
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

markdorison created an issue. See original summary.

markdorison’s picture

Issue summary: View changes

markdorison’s picture

Status: Active » Needs work

Per @adamzimmermann's feedback, I created an alternate MR implemented using State API. There are still some outstanding issues, but its a start.

markdorison’s picture

Title: Add "flat file" caching layer to prevent too frequent API refreshes » Add additional "caching" layer to prevent too frequent API refreshes
Issue summary: View changes

adamzimmermann made their first commit to this issue’s fork.

adamzimmermann’s picture

Status: Needs work » Needs review