MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / cacheGraph

Function cacheGraph

website/src/pages/Explore.tsx:120–137  ·  view source on GitHub ↗
(ref: RepoRef, graphData: any)

Source from the content-addressed store, hash-verified

118};
119
120const cacheGraph = async (ref: RepoRef, graphData: any): Promise<void> => {
121 try {
122 const db = await openDB();
123 return new Promise((resolve, reject) => {
124 const transaction = db.transaction(STORE_NAME, "readwrite");
125 const store = transaction.objectStore(STORE_NAME);
126 const request = store.put({
127 key: getCacheKey(ref),
128 graphData,
129 timestamp: Date.now()
130 });
131 request.onerror = () => reject(request.error);
132 request.onsuccess = () => resolve();
133 });
134 } catch (e) {
135 console.error("Failed to write to IndexedDB", e);
136 }
137};
138
139// ============================================================================
140// FETCH WITH PROGRESS TRACKING

Callers 2

autoFetchAndIndexFunction · 0.85
saveToCacheFunction · 0.85

Calls 4

getCacheKeyFunction · 0.90
openDBFunction · 0.85
resolveFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected