/** * Caching service with TTL support */ import NodeCache from 'node-cache'; /** * Cache TTL values in seconds */ export declare const CacheTTL: { readonly QUOTE: number; readonly HISTORICAL: number; readonly NEWS: number; readonly SEARCH: number; readonly INDICATOR: number; readonly MARKET_SUMMARY: 60; readonly INSIDER_TRADES: 3600; readonly INSTITUTIONAL_HOLDINGS: 86400; readonly OWNERSHIP_CHANGES: 3600; readonly MATERIAL_EVENTS: 1800; readonly FINANCIALS: 86400; readonly DCF: 3600; readonly CIK_MAPPING: 604800; readonly COMPANY_TICKERS: 86400; readonly DEFAULT: number; }; /** * Cache key prefixes for different data types */ export declare const CachePrefix: { readonly QUOTE: "quote"; readonly HISTORICAL: "historical"; readonly NEWS: "news"; readonly SEARCH: "search"; readonly INDICATOR: "indicator"; readonly MARKET: "market"; readonly WATCHLIST: "watchlist"; readonly INSIDER_TRADES: "insider_trades"; readonly INSTITUTIONAL: "institutional_holdings"; readonly OWNERSHIP: "ownership_changes"; readonly MATERIAL_EVENTS: "material_events"; readonly FINANCIALS: "financials"; readonly DCF: "dcf_valuation"; readonly CIK_MAP: "cik_map"; readonly COMPANY_TICKERS: "sec_company_tickers"; }; export declare class CacheService { private cache; private static instance; private constructor(); /** * Get singleton instance */ static getInstance(): CacheService; /** * Get a value from cache */ get(key: string): Promise; /** * Set a value in cache with optional TTL */ set(key: string, value: T, ttl?: number): Promise; /** * Delete a value from cache */ del(key: string): Promise; /** * Delete all keys matching a pattern */ delPattern(pattern: string): Promise; /** * Check if a key exists in cache */ has(key: string): Promise; /** * Flush all cache entries */ flush(): void; /** * Get cache statistics */ getStats(): NodeCache.Stats; /** * Get or set pattern: get from cache, or compute and cache */ getOrSet(key: string, factory: () => Promise, ttl?: number): Promise; /** * Generate cache key for quote */ static generateQuoteKey(symbol: string): string; /** * Generate cache key for historical data */ static generateHistoricalKey(symbol: string, period1: string | Date, period2: string | Date | undefined, interval: string): string; /** * Generate cache key for news */ static generateNewsKey(symbol?: string): string; /** * Generate cache key for search */ static generateSearchKey(query: string): string; /** * Generate cache key for indicator */ static generateIndicatorKey(symbol: string, indicator: string, period: number, interval: string): string; /** * Generate cache key for market summary */ static generateMarketKey(type: 'summary' | 'trending'): string; /** * Generate cache key for watchlist */ static generateWatchlistKey(name?: string): string; /** * Adjust TTL based on market hours * During market hours (9:30 AM - 4:00 PM ET), use shorter TTL * After hours, use longer TTL */ static getAdjustedTTL(baseTTL: number): number; } export declare const cacheService: CacheService; //# sourceMappingURL=cache.d.ts.map