IndexedDbCache implements a cache of keyed ArrayBuffers based on IDB. The caching is performed in a WebWorker for performance reasons. This class creates that worker and provides interop via message passing, presenting a Promise- based API to any consumers.

Hierarchy

  • IndexedDbCache

Constructors

Properties

counter: number

A simple counter is used to assign cross-context Ids for transactions

host: URL

The host on which to find the WebWorker script.

state: string

The current state of the database behind the cache. Requests will be held so long as it is not Open. If the database is Closed, then all requests, new and old, are fulfilled empty.

transactions: any

Resources for in-progress get requests

worker: any

The WebWorker that handles the IndexedDb requests. Each instance of this class gets its own worker.

Methods

  • Writes the ArrayBuffer into the Cache at Key. The write may take some time to complete. It is also not guaranteed. However, it is OK to issue multiple writes to the same key at the same time.

    Parameters

    • url: string
    • data: ArrayBuffer

    Returns void

Generated using TypeDoc