Skip to content

@loontail/minecraft-kit / PersistentMetadataCacheOptions

Type Alias: PersistentMetadataCacheOptions

ts
type PersistentMetadataCacheOptions = {
  directory: string;
  onWriteError?: (error) => void;
  ttlMs?: number;
};

Defined in: src/http/persistent-cache.ts:24

Options for createPersistentMetadataCache.

Example

ts
import { createPersistentMetadataCache, MinecraftKit } from "@loontail/minecraft-kit";

const cache = await createPersistentMetadataCache({
  directory: path.join(app.getPath("userData"), "kit-metadata-cache"),
  onWriteError: (error) => log.warn("metadata cache write failed", error),
});
const kit = new MinecraftKit({ cache });

Properties

PropertyModifierTypeDescriptionDefined in
directoryreadonlystringDirectory the cache owns; created on first write. One JSON file per entry.src/http/persistent-cache.ts:26
onWriteError?readonly(error) => voidCalled when a background disk write/delete fails. The in-memory layer stays correct regardless, so a failed persist only costs the next process a cache miss — surface it as a warning rather than letting it reject anything.src/http/persistent-cache.ts:34
ttlMs?readonlynumberRetention per entry, in milliseconds. Defaults to PERSISTENT_CACHE_TTL_MS.src/http/persistent-cache.ts:28

MIT License