/**
 * Performance metrics for database operations
 */
export interface PerformanceMetrics {
    operationName: string;
    duration: number;
    timestamp: Date;
    success: boolean;
    error?: string;
    metadata?: Record<string, any>;
}
/**
 * Aggregated performance statistics
 */
export interface PerformanceStats {
    totalOperations: number;
    successfulOperations: number;
    failedOperations: number;
    averageDuration: number;
    minDuration: number;
    maxDuration: number;
    p50Duration: number;
    p95Duration: number;
    p99Duration: number;
    errorRate: number;
    operationsPerSecond: number;
}
/**
 * Performance monitor and cache for database operations
 */
export declare class DatabasePerformanceMonitor {
    private metrics;
    private cacheMap;
    private maxMetrics;
    private defaultCacheTtlMs;
    private maxCacheSize;
    constructor(maxMetrics?: number, defaultCacheTtlMs?: number, // 5 minutes
    maxCacheSize?: number);
    /**
     * Measure and record the performance of an operation
     */
    measureOperation<T>(operationName: string, operation: () => Promise<T>, metadata?: Record<string, any>): Promise<T>;
    /**
     * Record a performance metric
     */
    private recordMetric;
    /**
     * Get performance statistics for a specific operation or all operations
     */
    getStats(operationName?: string): PerformanceStats;
    /**
     * Calculate percentile from sorted array
     */
    private percentile;
    /**
     * Cache a value with optional TTL
     */
    cache<T>(key: string, value: T, ttlMs?: number): void;
    /**
     * Get a cached value
     */
    getCached<T>(key: string): T | null;
    /**
     * Execute operation with caching
     */
    withCache<T>(key: string, operation: () => Promise<T>, ttlMs?: number): Promise<T>;
    /**
     * Clear cache entries
     */
    clearCache(pattern?: string): void;
    /**
     * Clean up expired cache entries
     */
    private cleanupCache;
    /**
     * Get cache statistics
     */
    getCacheStats(): {
        size: number;
        maxSize: number;
        hitRate: number;
        entries: Array<{
            key: string;
            accessCount: number;
            lastAccessed: Date;
            expiresAt: Date;
        }>;
    };
    /**
     * Get recent metrics
     */
    getRecentMetrics(limit?: number): PerformanceMetrics[];
    /**
     * Get metrics for a specific time range
     */
    getMetricsInRange(startTime: Date, endTime: Date): PerformanceMetrics[];
    /**
     * Export metrics as JSON
     */
    exportMetrics(): string;
    /**
     * Reset all metrics and cache
     */
    reset(): void;
}
/**
 * Global performance monitor instance
 */
export declare const performanceMonitor: DatabasePerformanceMonitor;
/**
 * Decorator for measuring method performance
 */
export declare function measurePerformance(operationName?: string): (target: any, propertyName: string, descriptor?: PropertyDescriptor) => PropertyDescriptor;
