import type { RetryPlugin } from '../../types';
import { RetryManager } from '../../core/RetryManager';
/**
 * Options for the CachingPlugin.
 */
export interface CachingPluginOptions {
    /**
     * If true, include the entire headers object in the cache key.
     * @default false
     */
    compareHeaders?: boolean;
    /**
     * Duration (in milliseconds) a cached entry is considered fresh.
     * If 0, the cache never expires.
     * @default 0
     */
    timeToRevalidate?: number;
    /**
     * HTTP methods to cache. By default, only GET requests are cached.
     * @default ['GET']
     */
    cacheMethods?: string[];
    /**
     * Interval in milliseconds to run cache cleanup.
     * If 0, periodic cleanup is disabled.
     * @default 0
     */
    cleanupInterval?: number;
    /**
     * Maximum age in milliseconds for cached items.
     * Items older than this will be removed during cleanup.
     * If 0, items don't expire based on age.
     * @default 0
     */
    maxAge?: number;
    /**
     * Maximum number of items to keep in cache.
     * If exceeded, oldest items will be removed first.
     * If 0, no limit is applied.
     * @default 1000
     */
    maxItems?: number;
    /**
     * If true, only requests that are retried will be cached.
     * Requests that are not retried will not be cached even if they are cacheable.
     * @default false
     */
    cacheOnlyRetriedRequests?: boolean;
}
export declare class CachingPlugin implements RetryPlugin {
    name: string;
    version: string;
    private manager;
    private interceptorIdReq;
    private interceptorIdRes;
    private cache;
    private cacheLock;
    private cleanupTimer;
    private readonly options;
    constructor(options?: CachingPluginOptions);
    initialize(manager: RetryManager): void;
    onBeforeDestroyed(): void;
    /**
     * Checks if there is a fresh cached response and handles the request accordingly.
     */
    private handleRequest;
    /**
     * Handles successful responses by caching them when appropriate.
     */
    private handleResponseSuccess;
    /**
     * Generates a unique cache key based on the request configuration.
     */
    private generateCacheKey;
    private startPeriodicCleanup;
    private stopPeriodicCleanup;
    private runCacheCleanup;
    /**
     * Manually clears all cache entries.
     */
    clearCache(): void;
    /**
     * Returns current cache statistics.
     */
    getCacheStats(): {
        size: number;
        oldestItemAge: number;
        newestItemAge: number;
        averageAge: number;
    };
}
