/** * File-based TTL cache for cross-process API call deduplication. * * Dashboard and CLI share cached data via /tmp/perp-cli-cache/. * Writes are atomic (write to .tmp then rename) to prevent partial reads. */ export declare const TTL_ACCOUNT = 15000; export declare const TTL_MARKET = 30000; export declare function getCached(key: string): T | null; export declare function setCached(key: string, data: T, ttlMs: number): void; /** * Read-through cache: returns cached data if fresh, else fetches and caches. * Used by dashboard and read-only queries. */ export declare function withCache(key: string, ttlMs: number, fetcher: () => Promise): Promise; /** * Write-through fetch: always fetches live data, then writes to cache for others to use. * Used by execution layer (CLI trades) where stale data is unacceptable. */ export declare function fetchAndCache(key: string, ttlMs: number, fetcher: () => Promise): Promise; /** * Invalidate cache entries matching a prefix (e.g., "acct" after a trade). */ export declare function invalidateCache(keyPrefix?: string): void;