Skip to content

API reference > @kontsedal/olas-core > LocalCache

LocalCache type ​

A cache owned by one controller — no sharing across the tree. Returned bycreateCache(ctx, fetcher, options?). Disposed automatically with the controller.

Signature:

typescript
type LocalCache<T> = AsyncState<T> & {
  invalidate(): Promise<void>;
  setData(updater: (prev: T | undefined) => T): Snapshot;
  write(updater: (prev: T | undefined) => T): void;
  replace(value: T): void;
  dispose(): void;
};

References: AsyncState, Snapshot

Released under the MIT License.