Appearance
@loontail/minecraft-kit v0.8.14 / createPersistentMetadataCache
Function: createPersistentMetadataCache()
ts
function createPersistentMetadataCache(options): Promise<PersistentMetadataCache>Create a MetadataCache that survives process restarts. Resolved version manifests, asset indexes, and runtime indexes written during one launch are still readable on the next — so a target resolved while online resolves offline later without the per-endpoint 30s network stall. This is the kit side of the launcher's fully-offline status seed (launcher optimization-13).
The cache is in-memory for reads (so the synchronous MetadataCache.get contract is honoured) and write-through to disk. The factory is async because it hydrates the in-memory layer from disk, dropping (and cleaning up) entries that have passed their ttlMs.
Per-entry retention is the cache's own ttlMs, not the short per-call TTL the metadata layer passes — that short TTL guards a single process against serving stale data, whereas persistence exists precisely to outlive it.
Parameters
| Parameter | Type |
|---|---|
options | PersistentMetadataCacheOptions |
Returns
Promise<PersistentMetadataCache>
Example
ts
import { createPersistentMetadataCache, MinecraftKit } from "@loontail/minecraft-kit";
const cache = await createPersistentMetadataCache({ directory });
const kit = new MinecraftKit({ cache });
const target = await kit.targets.resolve(input); // hits disk cache when offline