Skip to content

feat: support invalidate persistent cache using config.mode and config.name - #8920

Merged
jerrykingxyz merged 2 commits into
mainfrom
jerry/cache
Jan 2, 2025
Merged

feat: support invalidate persistent cache using config.mode and config.name#8920
jerrykingxyz merged 2 commits into
mainfrom
jerry/cache

Conversation

@jerrykingxyz

@jerrykingxyz jerrykingxyz commented Jan 2, 2025

Copy link
Copy Markdown
Contributor

Summary

Support invalidate persistent cache using config.mode and config.name.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions github-actions Bot added release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack. labels Jan 2, 2025
@netlify

netlify Bot commented Jan 2, 2025

Copy link
Copy Markdown

Deploy Preview for rspack ready!

Name Link
🔨 Latest commit 52d566d
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/677648a8afe8d50008aabfcf
😎 Deploy Preview https://deploy-preview-8920--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@codspeed-hq

codspeed-hq Bot commented Jan 2, 2025

Copy link
Copy Markdown
Contributor

CodSpeed Performance Report

Merging #8920 will not alter performance

Comparing jerry/cache (52d566d) with main (aa8732c)

Summary

✅ 3 untouched benchmarks

@jerrykingxyz
jerrykingxyz merged commit 96084cc into main Jan 2, 2025
@jerrykingxyz
jerrykingxyz deleted the jerry/cache branch January 2, 2025 08:46
@h-a-n-a h-a-n-a mentioned this pull request Jan 7, 2025
@slorber

slorber commented Jan 7, 2025

Copy link
Copy Markdown

Hey 👋

Just wondering, do you also plan to support cache.name like webpack?

On Docusaurus we have to manage multiple caches with

const name = isServer ? 'server' : 'client';
const mode = isProd ? 'production' : 'development';


cache.name: `${name}-${mode}-${props.i18n.currentLocale}`

More details here:

@jerrykingxyz

jerrykingxyz commented Jan 9, 2025

Copy link
Copy Markdown
Contributor Author

@slorber We currently have no plans to support cache.name since this field provides the same features as cache.version, just use cache.version.

cache.version: props.i18n.currentLocale + ...

@chenjiahan

Copy link
Copy Markdown
Member

@jerrykingxyz We can add some guides for migrating from the webpack cache configuration to Rspack experiments cache.

@slorber

slorber commented Feb 14, 2025

Copy link
Copy Markdown

Hi @jerrykingxyz

@slorber We currently have no plans to support cache.name since this field provides the same features as cache.version, just use cache.version.

I tried that and it works, but I noticed a difference, explained in facebook/docusaurus#10931 (comment)

In Webpack, when the version changes, the cache dir remains clean over time:

image

In Rspack, when the version changes, the cache dir continues to grow, with new subfolders being added, and the former ones not being removed:

image

It's not a big deal to me, but I thought I should report this issue and it could be better to avoid a .cache/rspack dir that grows indefinitely over time

@jerrykingxyz

jerrykingxyz commented Feb 14, 2025

Copy link
Copy Markdown
Contributor Author

In Rspack, when the version changes, the cache dir continues to grow, with new subfolders being added, and the former ones not being removed

@slorber Yes, Rspack will try to clean up cache dir that have not been used for a long time(7 days) every time the program is started. https://rspack.dev/config/experiments#cachestorage

The current directory structure is not necessarily a perfect solution, but we hope to expose as few configuration items as possible so that the subsequent remote cache can have more flexibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants