Skip to content

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

@AndlerRL

Description

@AndlerRL
          **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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions