UNPKG

@mdfriday/foundry

Version:

The core engine of MDFriday. Convert Markdown and shortcodes into fully themed static sites – Hugo-style, powered by TypeScript.

35 lines (34 loc) 1.02 kB
export declare class ConcurrentCache<K, V> { private cache; private pendingPromises; private deletedKeys; constructor(); get(key: K): V | undefined; set(key: K, value: V): void; has(key: K): boolean; isPending(key: K): boolean; delete(key: K): boolean; clear(): void; size(): number; pendingCount(): number; getOrCreate(key: K, create: (key: K) => Promise<V>): Promise<V>; private createAndCache; private executeCreate; getStats(): CacheStats; preload(entries: Array<{ key: K; create: (key: K) => Promise<V>; }>): Promise<void>; } export interface CacheStats { size: number; pendingCount: number; keys: unknown[]; pendingKeys: unknown[]; } export interface DynaCache<K, V> { getOrCreate(key: K, create: (key: K) => Promise<V>): Promise<V>; getStats?(): CacheStats; } export declare function createCache<K, V>(): ConcurrentCache<K, V>; export declare const globalBuildCache: ConcurrentCache<string, any>;