/**
 * Source Cache Factory
 *
 * Factory for creating cache instances for plugin sources.
 * Provides a bridge between the source utilities and the infrastructure CacheService.
 *
 * This allows sources to use either:
 * 1. The simple SourceCache from utils (lightweight, in-memory only)
 * 2. The full CacheService from infrastructure (size limits, persistence, stats)
 *
 * @since v1.39.0
 */
import { generateCacheKey, getCacheService } from '../../infrastructure/cache/cache-service.js';
import { type CacheStats, type SourceCacheOptions } from './utils/source-cache.js';
/**
 * Source cache configuration
 */
export interface SourceCacheConfig {
    /** Source name (used for cache key prefixes) */
    sourceName: string;
    /** Default TTL in milliseconds (default: 5 minutes) */
    defaultTtl?: number;
    /** Maximum cache entries (default: 500) */
    maxSize?: number;
    /** Use infrastructure CacheService instead of simple SourceCache (default: false) */
    useInfrastructure?: boolean;
    /** Enable debug logging (default: false) */
    debug?: boolean;
}
/**
 * Unified cache interface that works with both cache implementations
 */
export interface ISourceCache<T> {
    /** Get a value from cache */
    get(key: string): T | undefined;
    /** Set a value in cache */
    set(key: string, data: T, ttlMs?: number): void;
    /** Check if key exists */
    has(key: string): boolean;
    /** Delete a key */
    delete(key: string): boolean;
    /** Clear all entries */
    clear(): void;
    /** Invalidate entries matching pattern */
    invalidate(pattern?: RegExp | string): number;
    /** Get cache size */
    readonly size: number;
    /** Get cache statistics */
    getStats(): CacheStats;
    /** Reset statistics */
    resetStats(): void;
    /** Get or set with async fetcher */
    getOrSet(key: string, fetcher: () => Promise<T>, ttlMs?: number): Promise<T>;
}
/**
 * Create a cache instance for a plugin source
 *
 * @example
 * ```typescript
 * // Simple cache (default)
 * const cache = createSourceCacheForSource<PluginInfo>({
 *   sourceName: 'modrinth',
 *   defaultTtl: 5 * 60 * 1000,
 * });
 *
 * // Use infrastructure CacheService
 * const cache = createSourceCacheForSource<PluginInfo>({
 *   sourceName: 'modrinth',
 *   useInfrastructure: true,
 * });
 *
 * // Usage
 * const info = await cache.getOrSet('plugin:essentialsx', () => fetchPluginInfo('essentialsx'));
 * ```
 */
export declare function createSourceCacheForSource<T>(config: SourceCacheConfig): ISourceCache<T>;
/**
 * Get the global CacheService singleton
 * Use this when you need access to the shared infrastructure cache
 */
export { getCacheService, generateCacheKey };
/**
 * Type re-exports for convenience
 */
export type { CacheStats, SourceCacheOptions };
//# sourceMappingURL=source-cache-factory.d.ts.map