tvmjs
    Preparing search index...

    Class ArtifactIndexedDBCache

    Cache by IndexedDB to support caching model data

    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>

    • Parameters

      • url: string
      • response: any
      • Optionalstoretype: string

      Returns Promise<void>

    • Parameters

      • url: string

      Returns Promise<any>

    • Retrieve data object that corresponds to url from cache. If data object does not exist in cache, fetch the data and then add to cache.

      Parameters

      • url: string

        The url to the data to be cached. *

      • Optionalstoretype: string

        This field is required so that ArtifactIndexedDBCache can store the actual data object (see addToCache()), while ArtifactCache which uses the Cache API can return the actual data object rather than the request. There are two options:

        1. "json": returns equivalent to fetch(url).json()
        2. "arraybuffer": returns equivalent to fetch(url).arraybuffer()
      • Optionalsignal: AbortSignal

        An optional AbortSignal allowing user to abort the fetching before its completion.

      Returns Promise<any>

      The data object (i.e. users do not need to call .json() or .arraybuffer()).

      • Note: This is an async function.