Skip to content

WIP: Spike store cv value for nxt 601#377

Draft
dalecreativ wants to merge 58 commits intomainfrom
spike-store-cv-value-for-NXT-601
Draft

WIP: Spike store cv value for nxt 601#377
dalecreativ wants to merge 58 commits intomainfrom
spike-store-cv-value-for-NXT-601

Conversation

@dalecreativ
Copy link
Contributor

Purpose

This spike explores caching the Storyblok cv (cache version) value locally in memory to avoid unnecessary calls to the spaces/me endpoint on every request, improving efficiency and enabling Ocelot to cache responses consistently (avoiding redirects caused by stale cv)

Work so far:

  • Introduced a new getCachedCv() function that:
    • Returns a locally cached cv if it’s within a configurable TTL (longTTL)
    • Falls back to calling fetchCacheVersion() if stale or missing
  • Updated fetchStory() to use getCachedCv() instead of always calling fetchCacheVersion()
  • Preserved existing Storyblok SDK integration (getStoryblokApi)
  • Added logger.info and logger.warn messages to track:
    • When the cached value is reused
    • When a new value is fetched
  • Ensured fetchCacheVersion() is still the single source of truth for interacting with the spaces/me endpoint

shilpanice and others added 30 commits April 28, 2025 14:14
Co-authored-by: beccadawson <beccadawson@users.noreply.github.com>
Co-authored-by: John Davey <johndavey72@users.noreply.github.com>
…and add request url to file for ease of updating
…into relevant test files to avoid invalid JSON errors
…correct changes to remove data object from response shape, update note for how to generate mock data
… update (except StoryblokImage where comment is added to explain need for real path)
https://nicedigital.atlassian.net/browse/NXT-601

* NXT-601 Add new v2 ocelot endpoint to config and update calls

* NXT-601 update default.yaml to use new v2 endpoint
shilpanice and others added 28 commits May 8, 2025 11:12
Co-authored-by: Shilpa Unni <shilpanice@users.noreply.github.com>
Co-authored-by: beccadawson <beccadawson@users.noreply.github.com>
…tore cv value in memory, check against it before making further calls to SB API, and improve some logging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants