@refinio/one.models
    Preparing search index...

    This cache caches objects so that they can be accessed faster and synchronously later.

    Type Parameters

    • T extends OneObjectTypes
    Index

    Constructors

    Properties

    onError: OEvent<(error: any) => void> = ...
    onUpdate: OEvent<(objHash: SHA256Hash<T>, obj: T) => void> = ...

    Methods

    • Load the object and put it in the cache.

      After successful loading the onUpdate event is emitted.

      Parameters

      • objHash: SHA256Hash<T>

        Hash of object to load.

      Returns void

    • Same as loadObjectIntoCache, except that it does a runtime check on $type$ field.

      The runtime check is done against the values passed in the constructor. If the runtime check fails the onError event will fire.

      Parameters

      • objHash: SHA256Hash

      Returns void

    • Get the object from the cache or undefined if it is not cached.

      Parameters

      • objHash: SHA256Hash<T>

      Returns undefined | T

    • Load the object or query it from cache if it was loaded previously.

      Parameters

      • objHash: SHA256Hash<T>

      Returns Promise<T>

    • Same as queryOrLoadObjectIntoCache, except that it does a runtime check on $type$ field.

      The runtime check is done against the values passed inthe constructor. If the runtime check fails the promise will reject.

      Parameters

      • objHash: SHA256Hash

      Returns Promise<T>