/** * Cache System - In-memory and persistent caching for agents * Inspired by mastra's cache module */ export interface CacheConfig { name?: string; ttl?: number; maxSize?: number; } export interface CacheEntry { value: T; createdAt: number; expiresAt?: number; } /** * Abstract base class for cache implementations */ export declare abstract class BaseCache { readonly name: string; constructor(config?: CacheConfig); abstract get(key: string): Promise; abstract set(key: string, value: T, ttl?: number): Promise; abstract delete(key: string): Promise; abstract clear(): Promise; abstract has(key: string): Promise; abstract keys(): Promise; abstract size(): Promise; abstract listPush(key: string, value: T): Promise; abstract listLength(key: string): Promise; abstract listRange(key: string, start: number, end?: number): Promise; } /** * In-memory cache implementation */ export declare class MemoryCache extends BaseCache { private cache; private lists; private ttl?; private maxSize?; constructor(config?: CacheConfig); get(key: string): Promise; set(key: string, value: T, ttl?: number): Promise; delete(key: string): Promise; clear(): Promise; has(key: string): Promise; keys(): Promise; size(): Promise; listPush(key: string, value: T): Promise; listLength(key: string): Promise; listRange(key: string, start: number, end?: number): Promise; } /** * File-based cache implementation */ export declare class FileCache extends BaseCache { private cacheDir; private fs; private path; constructor(config?: CacheConfig & { cacheDir?: string; }); private ensureDir; private getFilePath; get(key: string): Promise; set(key: string, value: T, ttl?: number): Promise; delete(key: string): Promise; clear(): Promise; has(key: string): Promise; keys(): Promise; size(): Promise; listPush(key: string, value: T): Promise; listLength(key: string): Promise; listRange(key: string, start: number, end?: number): Promise; } export declare function createMemoryCache(config?: CacheConfig): MemoryCache; export declare function createFileCache(config?: CacheConfig & { cacheDir?: string; }): FileCache;