farm icon indicating copy to clipboard operation
farm copied to clipboard

Optimize persistent cache strategy

Open wre232114 opened this issue 10 months ago • 3 comments

What problem does this feature solve?

Currently when lockfile is changed, all cache will be invalidated. For some dependencies like components, they could be changed frequently, so Farm need to support configuring that if some packages are changed, only caches of these packages are invalidated, caches of other packages should be reused.

What does the proposed API look like?

  1. add a loose: boolean, when keys like lockfile changed with loose: true, all cache should not be invalidated, and Farm should validate cache for immutable modules.
  2. optimize optimize_module_graph and render_resource_pot_modules cache. optimize_module_graph should be cached to skip unnecessary calculations. and cache of render_resource_pot_modules should considering used exports info of the modules.
  3. Config can be modified in rust plugins, farm should use final config to generate cache key for global keys.
  4. Optimize cache storage algorithm, there are thousands of modules generated under node_modules/.farm/cache, we needs to limit the storage usege

wre232114 avatar Apr 18 '24 08:04 wre232114

有进展吗?我非常关心该功能

289420843 avatar Apr 22 '24 08:04 289420843

正在实现中,会优先支持

wre232114 avatar Apr 22 '24 08:04 wre232114

可设置 persistentCache: { globalBuiltinCacheKeyStrategy: { lockfile: false } } } 关闭 lockfile 的检查

wre232114 avatar Apr 25 '24 02:04 wre232114