Appearance
@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
| Member | Type | Description |
|---|---|---|
directory | string | Directory the cache owns; created on first write. One JSON file per entry. |
onWriteError | (error) => void | Called 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. |
ttlMs | number | Retention per entry, in milliseconds. Defaults to PERSISTENT_CACHE_TTL_MS. |