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

Method addToCache

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

Source from the content-addressed store, hash-verified

531 }
532
533 async addToCache(url: string, storetype?: string, signal?: AbortSignal): Promise<void> {
534 await this.initDB(); // await the initDB process
535 // If already cached, nothing to do
536 const isInDB = await this.isUrlInDB(url);
537 if (isInDB) {
538 return;
539 }
540 try {
541 const response = await fetch(url, signal ? { signal } : undefined);
542 if (!response.ok) {
543 throw new Error('Network response was not ok');
544 }
545 const response_copy = response.clone();
546 await this.addToIndexedDB(url, response_copy, storetype);
547 } catch (error) {
548 throw Error("Failed to store " + url + " with error: " + error);
549 }
550 }
551
552 async hasAllKeys(keys: string[]): Promise<boolean> {
553 await this.initDB(); // Ensure the DB is initialized

Callers 1

fetchWithCacheMethod · 0.95

Calls 4

initDBMethod · 0.95
isUrlInDBMethod · 0.95
addToIndexedDBMethod · 0.95
cloneMethod · 0.45

Tested by

no test coverage detected