import * as z from 'zod';
export interface CacheOptions {
    /** Maximum number of items the cache can hold */
    itemLimit: number;
    /** @todo replace with `Temporal.DurationLike` */
    ttl: number;
}
export declare const CacheData: z.ZodRecord<z.ZodString, z.ZodObject<{
    $timestamp: z.ZodCoercedDate<unknown>;
}, z.core.$loose>>;
/** @todo replace `$timestamp` with `Temporal.InstantLike` */
export interface CacheData<V> extends Record<string, V & {
    $timestamp: number;
}> {
}
declare const kTimestamp: unique symbol;
/**
 * Cache some arbitrary operation.
 * This is primarily intended for de-duplicating API requests
 */
export declare class Cache<Keys extends string[], V extends object> {
    /**
     * Function to run when there is a cache miss
     * @
     */
    protected readonly miss: (...keys: Keys) => V | Promise<V>;
    protected items: Map<string, V & {
        [kTimestamp]: number;
    }>;
    protected pending: Map<string, Promise<V>>;
    readonly options: CacheOptions;
    private onWrite?;
    constructor(
    /**
     * Function to run when there is a cache miss
     * @
     */
    miss: (...keys: Keys) => V | Promise<V>, options?: Partial<CacheOptions>);
    protected key(keys: Keys): string;
    get size(): number;
    protected valid(timestamp?: number): boolean;
    protected write(key: string, value: V | Promise<V>): void;
    get(...keys: Keys): V | Promise<V>;
    set(...args: [...keys: Keys, value: V | Promise<V>]): void;
    invalidate(...keys: Keys): void;
    persist(onWrite: (data: CacheData<V>) => void, 
    /** @todo replace `$timestamp` with `Temporal.InstantLike` */
    existingContent?: Record<string, V & {
        $timestamp?: number;
    }>): void;
    toJSON(): CacheData<V>;
}
export default Cache;
