Skip to content

@loontail/minecraft-kit v0.8.14 / PersistentMetadataCacheOptions

Type alias: PersistentMetadataCacheOptions

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

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 });

Type declaration

MemberTypeDescription
directorystringDirectory the cache owns; created on first write. One JSON file per entry.
onWriteError(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.
ttlMsnumberRetention per entry, in milliseconds. Defaults to PERSISTENT_CACHE_TTL_MS.

Source

src/http/persistent-cache.ts:24

MIT License