-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DEV-2122] implement in-memory caching for CMS API data retrieval #1318
base: main
Are you sure you want to change the base?
Conversation
- Introduced a new `cache.ts` file to manage an in-memory cache for API responses. - Updated multiple functions in `cmsApi.ts` to utilize the caching mechanism, improving performance by reducing redundant API calls. - Each API function now caches results for 15 minutes (900 seconds) using a unique cache key generated by `getCacheKey`. - Enhanced type safety by replacing `any` with `unknown` in the cache implementation. This change optimizes data fetching and reduces load on the CMS API.
🦋 Changeset detectedLatest commit: c2d44b4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Bundle not found for branch |
Branch is not up to date with base branch@tommaso1 it seems this Pull Request is not updated with base branch. |
Jira Pull Request LinkThis Pull Request refers to the following Jira issue DEV-2122 |
const strapiHomepage = await fetchHomepage(buildEnv); | ||
return makeHomepageProps(strapiHomepage); | ||
}, | ||
900 // 15 minutes in seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should convert this into a env var ot at least a constant in this file
900 // 15 minutes in seconds | |
900 // 15 minutes in seconds |
List of Changes
cache.ts
file to manage an in-memory cache for API responses.cmsApi.ts
to utilize the caching mechanism, improving performance by reducing redundant API calls.getCacheKey
.any
withunknown
in the cache implementation.This change optimizes data fetching and reduces load on the CMS API.
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: