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

Method addToCache

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

Source from the content-addressed store, hash-verified

718 }
719
720 async addToCache(
721 url: string,
722 _storetype?: StoreType,
723 signal?: AbortSignal,
724 ): Promise<void> {
725 const existing = await this.storage.match(url);
726 if (existing !== undefined) {
727 return;
728 }
729 const request = new Request(
730 url,
731 signal ? { ...DEFAULT_FETCH_OPTIONS, signal } : DEFAULT_FETCH_OPTIONS,
732 );
733 const response = await fetch(request);
734 if (!response.ok) {
735 throw new Error(
736 `ArtifactCrossOriginStorageCache: Unable to fetch ${url}, received status ${response.status}`,
737 );
738 }
739 await this.storage.put(url, response.clone());
740 }
741
742 async hasAllKeys(keys: string[]): Promise<boolean> {
743 const results = await Promise.all(

Callers 1

fetchWithCacheMethod · 0.95

Calls 3

matchMethod · 0.45
putMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected