MCPcopy Create free account
hub / github.com/codag-megalith/codag-visualizer / loadCache

Method loadCache

frontend/src/cache.ts:145–168  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

143 }
144
145 private async loadCache() {
146 if (!this.cachePath) return;
147
148 try {
149 const cacheContent = await vscode.workspace.fs.readFile(this.cachePath);
150 const parsed = JSON.parse(cacheContent.toString());
151
152 if (parsed.version === CACHE_VERSION) {
153 this.files = parsed.files || {};
154 this.crossFileEdges = parsed.crossFileEdges || [];
155 this.workflows = parsed.workflows || {};
156 } else {
157 // Different version - start fresh
158 console.log(`Cache version ${parsed.version} → ${CACHE_VERSION}, clearing cache`);
159 this.files = {};
160 this.crossFileEdges = [];
161 this.workflows = {};
162 }
163 } catch (error) {
164 this.files = {};
165 this.crossFileEdges = [];
166 this.workflows = {};
167 }
168 }
169
170 private scheduleSave() {
171 const now = Date.now();

Callers 1

initializeCacheMethod · 0.95

Calls 2

parseMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected