UNPKG

@stacksjs/stx

Version:

A performant UI Framework. Powered by Bun.

54 lines 1.44 kB
/** * Get item from cache */ export declare function getCached<T>(src: string, options: Record<string, unknown>, type: 'image' | 'video', config?: CacheConfig): Promise<T | null>; /** * Set item in cache */ export declare function setCached<T>(src: string, options: Record<string, unknown>, data: T, type: 'image' | 'video', config?: CacheConfig): Promise<void>; /** * Clear cache for a specific source */ export declare function clearCacheForSource(src: string, type: 'image' | 'video', config?: CacheConfig): Promise<void>; /** * Clear entire cache */ export declare function clearCache(type: 'image' | 'video' | 'all', config?: CacheConfig): Promise<void>; /** * Get cache statistics */ export declare function getCacheStats(config?: CacheConfig): Promise<{ memoryEntries: number diskEntries: { image: number; video: number } totalSizeMB: number }>; /** * Prune old cache entries */ export declare function pruneCache(config?: CacheConfig): Promise<number>; /** * Default cache configuration */ export declare const defaultCacheConfig: CacheConfig; /** * Cache entry metadata */ export declare interface CacheEntry<T = unknown> { key: string src: string srcHash: string srcMtime: number optionsHash: string data: T createdAt: number lastAccessedAt: number } /** * Cache configuration */ export declare interface CacheConfig { enabled: boolean directory: string maxAge: number maxSize: number }