MCPcopy
hub / github.com/apache/tvm / deleteTensorCache

Function deleteTensorCache

web/src/artifact_cache.ts:897–917  ·  view source on GitHub ↗
(
  cacheUrl: string,
  cacheScopeOrOptions: string | TensorCacheAccessOptions = "tvmjs",
  cacheType = "cache",
)

Source from the content-addressed store, hash-verified

895 cacheType?: string,
896): Promise<void>;
897export async function deleteTensorCache(
898 cacheUrl: string,
899 cacheScopeOrOptions: string | TensorCacheAccessOptions = "tvmjs",
900 cacheType = "cache",
901): Promise<void> {
902 const options = normalizeCacheAccessOptions(cacheScopeOrOptions, cacheType);
903 const cacheScope = options.cacheScope ?? "tvmjs";
904 const artifactCache = createArtifactCache(cacheScope, options);
905 if (artifactCache instanceof ArtifactCrossOriginStorageCache) {
906 // Cross-origin storage extension does not currently support programmatic deletion.
907 return;
908 }
909 const jsonUrl = new URL("tensor-cache.json", cacheUrl).href;
910 const list = await artifactCache.fetchWithCache(jsonUrl, "json");
911 const arrayentry = list["records"] as Array<TensorShardEntry>;
912 const processShard = async (i: number) => {
913 const dataUrl = new URL(arrayentry[i].dataPath, cacheUrl).href;
914 await artifactCache.deleteInCache(dataUrl);
915 }
916 await Promise.all(arrayentry.map((_, index) => processShard(index)));
917}

Callers

nothing calls this directly

Calls 4

createArtifactCacheFunction · 0.85
processShardFunction · 0.85
fetchWithCacheMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…