constructor(e, t) {
    super(), t ? (this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(t, () => {
      this.clear();
    })), this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r, i) => {
      i.length > 0 && this.clear();
    }))) : this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(() => {
      this.clear();
    }));
  }
Creates a new workspace cache.

@param sharedServices Service container instance to hook into document lifecycle events.
@param state 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.