/** * Caching Layer * * In-memory caching with TTL using node-cache */ import NodeCache from 'node-cache'; /** * Shared cache instance */ export declare const cache: NodeCache; /** * Cache TTL configuration by data type (in seconds) * * TTL Selection Criteria: * * 1. **Data Volatility**: How frequently the underlying data changes * - High volatility (user actions, market prices) = shorter TTL * - Low volatility (configuration, historical data) = longer TTL * * 2. **User Expectations**: How "fresh" users expect data to be * - Real-time needs (portfolio values) = shorter TTL * - Historical analysis (past performance) = longer TTL * * 3. **API Load Impact**: Balance between freshness and server load * - Frequently accessed endpoints = moderate TTL for load reduction * - Expensive queries (aggregations) = longer TTL for performance * * 4. **Data Type Characteristics**: * - Static reference data (schema, glossary) = 24h+ * - Analytical results (predictions, risk) = 15-60min * - User-specific data (portfolio) = 5min * - Search/filter results = 10min * - Historical data (performance, prices) = 30min */ export declare const cacheTTL: { readonly vaultData: 900; readonly userPortfolio: 300; readonly searchResults: 600; readonly performance: 1800; readonly transactions: 300; readonly schema: 86400; readonly comparison: 900; readonly priceHistory: 1800; readonly riskAnalysis: 900; readonly yieldPrediction: 3600; readonly portfolioOptimization: 300; readonly composition: 900; readonly globalTvl: 300; readonly indexingStatus: 60; readonly historicalState: 3600; }; /** * Search filters type for cache key generation */ type SearchFilters = { filterHash: string; }; /** * Cache key generators * * Provides consistent cache key formatting for different data types */ export declare const cacheKeys: { vaultData: (address: string, chainId: number) => string; userPortfolio: (address: string) => string; searchVaults: (filters: SearchFilters) => string; vaultPerformance: (address: string, chainId: number, range: string) => string; transactions: ({ vaultAddress, chainId, filterHash, first, skip, orderBy, orderDirection, }: { vaultAddress: string; chainId: number; filterHash: string; first: number; skip: number; orderBy: string; orderDirection: string; }) => string; schema: () => string; compareVaults: (addresses: string[], chainIds: number[]) => string; priceHistory: (address: string, chainId: number, range: string) => string; composition: (address: string, chainId: number) => string; }; /** * Generate cache key based on cache tag and parameters * * NEW: Generic cache key generator for fragment-level caching * Used to create consistent cache keys across different tools * * @param tag - Cache tag identifying the data type * @param params - Parameters for cache key generation * @returns Generated cache key string */ export declare function generateCacheKey(tag: string, params: Record): string; /** * Cache statistics */ export declare function getCacheStats(): NodeCache.Stats; /** * Clear all cache entries */ export declare function clearCache(): void; export {}; //# sourceMappingURL=index.d.ts.map