Member Junction
    Preparing search index...

    Caching class for Entity Documents and Entity Document Types.

    Delegates Entity Document storage to KnowledgeHubMetadataEngine (which uses BaseEngine auto-refresh on entity events), and only independently caches Entity Document Types (which KH engine does not manage).

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    StaleAfterMs: number = 60_000

    How long a load stays trusted, in milliseconds.

    _loaded used to be a one-way latch: the first Refresh(false) set it and nothing ever cleared it, and every production caller passes false (entityVectorSync.GetEntityDocument/GetEntityDocumentByName, the Vectorize Entity action, KnowledgePipeline, KnowledgeAgent). In a long-lived MJAPI that made Entity Document and Entity Document Type edits invisible until the process was restarted — and _typeCache is only ever populated inside Refresh, so document types were restart-only unconditionally, no matter what any caller passed.

    A window rather than "always reload" is deliberate: Refresh is called once per lookup, and a vectorize run over many entities would otherwise re-read this metadata for each one. Within the window a repeat call is still skipped; past it the next call reloads.

    Set to 0 to reload on every call, or to Number.POSITIVE_INFINITY to restore the old latch. Hosts that know when their metadata changes should call Invalidate instead of widening this.

    Accessors

    • get GlobalKey(): string

      Returns string

    Methods

    • The Global Object Store is a place to store global objects that need to be shared across the application. Depending on the execution environment, this could be the window object in a browser, or the global object in a node environment, or something else in other contexts. The key here is that in some cases static variables are not truly shared because it is possible that a given class might have copies of its code in multiple paths in a deployed application. This approach ensures that no matter how many code copies might exist, there is only one instance of the object in question by using the Global Object Store.

      Returns GlobalObjectStore

    • Refreshes the cache. Entity Documents are loaded via KnowledgeHubMetadataEngine (auto-refreshing BaseEngine). Entity Document Types are loaded independently.

      This method is the only gate. Callers should invoke it unconditionally rather than pre-checking IsLoaded — a caller-side if (!IsLoaded) reintroduces the latch this removed by skipping the staleness check entirely.

      Parameters

      • forceRefresh: boolean
      • OptionalContextUser: UserInfo

      Returns Promise<void>

    • Returns the singleton instance of the class. If the instance does not exist, it is created and stored in the Global Object Store. If className is provided it will be used as part of the key in the Global Object Store, otherwise the actual class name will be used. NOTE: the class name used by default is the lowest level of the object hierarchy, so if you have a class that extends another class, the lowest level class name will be used.

      Type Parameters

      Parameters

      • this: new () => T
      • OptionalclassName: string

      Returns T