You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To automatically purge the cache on version change, update the loadCache function in src/build_state/cache.ts to reset the cache if the version has changed. Here are the specific steps:
Modify the loadCache function to include a version check and reset the cache if the version has changed:
exportasyncfunctionloadCache(project: Project): Promise<Cache>{constbuildCachePath=genPath(project,CACHE_PATH);// Read hashes from fileletpersist: CachePersist;if(awaitexists(buildCachePath)){try{constoldCacheAny: any=JSON.parse(awaitDeno.readTextFile(buildCachePath),);// Validate versionif(oldCacheAny.version==CACHE_VERSION){persist=oldCacheAny;}else{persist=createEmptyCachePersist();awaitwriteCache(project,{ persist,hashDiffs: newMap()});// Purge cache}}catch{// If parsing fails or the cache isn't readable, reset the cache.persist=createEmptyCachePersist();}}else{persist=createEmptyCachePersist();}return{
persist,hashDiffs: newMap(),};}
This ensures that the cache is automatically purged and reset whenever the CACHE_VERSION changes.
Motivation
OpenGB doesn't manage cache compat between versions. It should auto-purge the cache if the version changes.
The text was updated successfully, but these errors were encountered: