StaticStaleHow 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.
True once a load has completed. Says nothing about whether that load is still fresh — see IsStale.
True when there is no load to trust: either nothing has loaded yet, or the last load has aged out.
StaticInstanceThe 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.
Drop the cached copy so the next Refresh reloads, regardless of the staleness window. The exact hook for a caller that knows metadata just changed out of band.
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.
OptionalContextUser: UserInfoProtected StaticgetReturns 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.
OptionalclassName: string
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).