Skip to content
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

suggestion (testing): Review and test caching logic for production environments - catching strategy #330

Open
AndlerRL opened this issue Aug 24, 2024 · 0 comments
Labels
discuss enhancement New feature or request feature New feature request

Comments

@AndlerRL
Copy link
Contributor

AndlerRL commented Aug 24, 2024

          **suggestion (testing):** Review and test caching logic for production environments

The new caching mechanism for blog data in production environments is a good performance improvement. Ensure that this change is thoroughly tested and that there's a strategy in place for cache invalidation when content is updated.

if (process.env.NODE_ENV === 'production') {
  const cacheKey = `blog_content_${filePath}`;
  const cachedContent = cache.get(cacheKey);

  if (cachedContent) {
    return cachedContent as ArticlesSection[];
  }

  const result = fileContents?.sections as ArticlesSection[];
  cache.set(cacheKey, result, 3600); // Cache for 1 hour
  return result;
}

Originally posted by @sourcery-ai[bot] in #324 (comment)


Should we cache the files like this? I did a research and maybe we can set up more config for SSG?

image

@AndlerRL AndlerRL changed the title **suggestion (testing):** Review and test caching logic for production environments - catching strategy suggestion (testing): Review and test caching logic for production environments - catching strategy Aug 24, 2024
@AndlerRL AndlerRL added enhancement New feature or request feature New feature request discuss labels Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss enhancement New feature or request feature New feature request
Projects
None yet
Development

No branches or pull requests

1 participant