UNPKG

@gabriel3615/ta_analysis

Version:

stock ta analysis

35 lines (34 loc) 807 B
export type CacheKey = string; export interface CacheEntry<T> { data: T; timestamp: number; ttl?: number; size?: number; } export interface CacheStats { hits: number; misses: number; hitRate: number; totalEntries: number; totalSize: number; } export declare class SimpleCache<T> { private maxEntries; private store; private hits; private misses; constructor(maxEntries?: number); get(key: CacheKey): T | undefined; set(key: CacheKey, data: T, options?: { ttl?: number; size?: number; }): void; getOrFetch(key: CacheKey, fetcher: () => Promise<T>, options?: { ttl?: number; size?: number; }): Promise<T>; clear(): void; size(): number; stats(): CacheStats; private pruneToCapacity; }