@intlayer/config
Version:
Retrieve Intlayer configurations and manage environment variables for both server-side and client-side environments.
25 lines (24 loc) • 1.61 kB
TypeScript
import { CacheKey } from "./cacheMemory.js";
import { IntlayerConfig } from "@intlayer/types/config";
//#region src/utils/cacheDisk.d.ts
type LocalCacheOptions = {
/** Preferred new option name */persistent?: boolean; /** Time-to-live in ms; if expired, disk entry is ignored. */
ttlMs?: number; /** Max age in ms based on stored creation timestamp; invalidates on exceed. */
maxTimeMs?: number; /** Optional namespace to separate different logical caches. */
namespace?: string; /** Gzip values on disk (on by default for blobs > 1KB). */
compress?: boolean;
};
/** Clears the in-memory portion of the disk cache without touching disk files. */
declare const clearDiskCacheMemory: () => void;
declare const cacheDisk: (intlayerConfig: IntlayerConfig, keys: CacheKey[], options?: LocalCacheOptions) => {
/** In-memory first, then disk (if enabled), otherwise undefined. */get: <T>() => Promise<T | undefined>; /** Sets in-memory (always) and persists to disk if enabled. */
set: (value: unknown) => Promise<void>; /** Clears only this entry from memory and disk. */
clear: () => Promise<void>; /** Clears ALL cached entries (memory Map and entire cacheDir namespace if persistent). */
clearAll: () => Promise<void>; /** Expose the computed id (useful if you want to key other structures). */
isValid: () => Promise<boolean>; /** Expose the computed id (useful if you want to key other structures). */
id: string; /** Expose the absolute file path for debugging. */
filePath: string;
};
//#endregion
export { cacheDisk, clearDiskCacheMemory };
//# sourceMappingURL=cacheDisk.d.ts.map