MCPcopy Create free account
hub / github.com/apache/tvm / fetchWithCache

Method fetchWithCache

web/src/artifact_cache.ts:492–506  ·  view source on GitHub ↗
(url: string, storetype?: string, signal?: AbortSignal)

Source from the content-addressed store, hash-verified

490 }
491
492 async fetchWithCache(url: string, storetype?: string, signal?: AbortSignal): Promise<any> {
493 await this.addToCache(url, storetype, signal);
494 let result = await this.asyncGetHelper(url);
495 if (result === null) {
496 // previously null data in cache or somehow failed to add to cache, delete and retry
497 await this.deleteInCache(url);
498 await this.addToCache(url, storetype);
499 result = await this.asyncGetHelper(url);
500 }
501 if (result != null && typeof result === "object" && "data" in result) {
502 // `storetype` not used here because the data stored in indexedDB is already in that type
503 return result.data;
504 }
505 throw Error("ArtifactIndexedDBCache failed to fetch: " + url);
506 }
507
508 async addToIndexedDB(url: string, response: any, storetype?: string) {
509 await this.initDB();

Callers

nothing calls this directly

Calls 3

addToCacheMethod · 0.95
asyncGetHelperMethod · 0.95
deleteInCacheMethod · 0.95

Tested by

no test coverage detected