tvmjs
    Preparing search index...

    Class ArtifactCache

    Cache to store model related data, implemented with the Cache API.

    Implements

    Index

    Constructors

    Methods

    • Fetch data from url and add into cache. If already exists in cache, should return instantly.

      Parameters

      • url: string

        The url to the data to be cached. *

      • Optionalstoretype: string

        Only applies to ArtifactIndexedDBCache. Since indexedDB stores the actual *

      • Optionalsignal: AbortSignal

        An optional AbortSignal to abort data retrival. data rather than a request, we specify storagetype. There are two options:

        1. "json": IndexedDB stores fetch(url).json()
        2. "arraybuffer": IndexedDB stores fetch(url).arrayBuffer()
        • Note: This is an async function.

      Returns Promise<void>

    • fetch the corresponding url object in response or stored object format

      Parameters

      • url: string

        url

      • Optionalstoretype: string

        the storage type for indexedDB

      • Optionalsignal: AbortSignal

        an optional abort signal to abort fetching

      Returns Promise<any>

      response in json, arraybuffer or pure response format

    • Determine if all keys exist in the cache

      Parameters

      • keys: string[]

        the url key list of the strings

      Returns Promise<boolean>

      boolean value indicate if all keys are in cache

    • Convert the Response object to the expected storetype instead

      Parameters

      • response: Response
      • Optionalstoretype: string

      Returns Promise<any>