Class DocumentCache<K, V>

Every key/value pair in this cache is scoped to a document. If this document is changed or deleted, all associated key/value pairs are deleted.

Type Parameters

  • K
  • V

Hierarchy (view full)

Constructors

  • Creates a new document cache.

    Type Parameters

    • K
    • V

    Parameters

    • sharedServices: LangiumSharedCoreServices

      Service container instance to hook into document lifecycle events.

    • Optionalstate: DocumentState

      Optional document state on which the cache should evict. If not provided, the cache will evict on DocumentBuilder#onUpdate. Deleted documents are considered in both cases.

      Providing a state here will use DocumentBuilder#onDocumentPhase instead, which triggers on all documents that have been affected by this change, assuming that the state is DocumentState.Linked or a later state.

    Returns DocumentCache<K, V>

Properties

isDisposed: boolean = false
toDispose: Disposable[] = []

Methods