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

Method addToCache

web/src/artifact_cache.ts:640–659  ·  view source on GitHub ↗
(
    url: string,
    _storetype?: string,
    signal?: AbortSignal,
  )

Source from the content-addressed store, hash-verified

638 }
639
640 async addToCache(
641 url: string,
642 _storetype?: string,
643 signal?: AbortSignal,
644 ): Promise<void> {
645 if (await this.store.has(url)) {
646 return;
647 }
648 const request = new Request(
649 url,
650 signal ? { ...DEFAULT_FETCH_OPTIONS, signal } : DEFAULT_FETCH_OPTIONS,
651 );
652 const response = await fetch(request);
653 if (!response.ok) {
654 throw new Error(
655 `ArtifactOPFSCache: Unable to fetch ${url}, received status ${response.status}`,
656 );
657 }
658 await this.store.write(url, response);
659 }
660
661 async hasAllKeys(keys: string[]): Promise<boolean> {
662 const results = await Promise.all(

Callers 1

fetchWithCacheMethod · 0.95

Calls 2

hasMethod · 0.80
writeMethod · 0.65

Tested by

no test coverage detected