UNPKG

qraft

Version:

A powerful CLI tool to qraft structured project setups from GitHub template repositories

134 lines 4.66 kB
import { BoxManifest, BoxReference, CacheEntry, RegistryManagerConfig } from '../types'; import { ManifestManager } from './manifestManager'; /** * CacheManager handles local caching of downloaded boxes for improved performance */ export declare class CacheManager { private cacheDirectory; private ttl; private enabled; private manifestManager; constructor(config: RegistryManagerConfig['cache']); /** * Generate a cache key for a box reference * @param boxRef Box reference * @returns string Cache key */ private generateCacheKey; /** * Get the cache file path for a box reference * @param boxRef Box reference * @returns string Path to cache file */ private getCacheFilePath; /** * Get the cache directory path for a box reference * @param boxRef Box reference * @returns string Path to cache directory for box files */ private getCacheDirectoryPath; /** * Check if a cache entry exists and is valid * @param boxRef Box reference * @returns Promise<boolean> True if valid cache exists */ hasValidCache(boxRef: BoxReference): Promise<boolean>; /** * Get cached box information * @param boxRef Box reference * @returns Promise<CacheEntry | null> Cache entry or null if not found/invalid */ getCacheEntry(boxRef: BoxReference): Promise<CacheEntry | null>; /** * Store box information and files in cache * @param boxRef Box reference * @param manifest Box manifest * @param files Array of file paths * @param fileContents Map of file paths to their content * @returns Promise<void> */ setCacheEntry(boxRef: BoxReference, manifest: BoxManifest, files: string[], fileContents: Map<string, Buffer>): Promise<void>; /** * Get cached file content * @param boxRef Box reference * @param filePath Relative file path within the box * @returns Promise<Buffer | null> File content or null if not cached */ getCachedFile(boxRef: BoxReference, filePath: string): Promise<Buffer | null>; /** * Remove a specific cache entry * @param boxRef Box reference * @returns Promise<void> */ removeCacheEntry(boxRef: BoxReference): Promise<void>; /** * Clear all cache entries * @returns Promise<void> */ clearCache(): Promise<void>; /** * Clean up expired cache entries * @returns Promise<number> Number of entries cleaned up */ cleanupExpiredEntries(): Promise<number>; /** * Get cache statistics * @returns Promise<{totalEntries: number, totalSize: number, cacheDirectory: string}> Cache statistics */ getCacheStats(): Promise<{ totalEntries: number; totalSize: number; cacheDirectory: string; }>; /** * Check if caching is enabled * @returns boolean True if caching is enabled */ isEnabled(): boolean; /** * Get cache directory path * @returns string Cache directory path */ getCacheDirectory(): string; /** * Get cache TTL in seconds * @returns number TTL in seconds */ getTTL(): number; /** * Store manifest in cache directory for a box * @param boxRef Box reference * @param manifest Box manifest * @param registry Registry identifier * @param boxReference Full box reference * @returns Promise<void> */ storeCachedManifest(boxRef: BoxReference, manifest: BoxManifest, registry?: string, boxReference?: string): Promise<void>; /** * Get cached manifest for a box * @param boxRef Box reference * @returns Promise<any | null> Cached manifest or null */ getCachedManifest(boxRef: BoxReference): Promise<any | null>; /** * Check if cached manifest exists for a box * @param boxRef Box reference * @returns Promise<boolean> True if cached manifest exists */ hasCachedManifest(boxRef: BoxReference): Promise<boolean>; /** * Sync cached manifest with remote manifest * @param boxRef Box reference * @param remoteManifest Remote manifest * @param registry Registry identifier * @param boxReference Full box reference * @returns Promise<boolean> True if sync was needed and performed */ syncCachedManifest(boxRef: BoxReference, remoteManifest: BoxManifest, registry?: string, boxReference?: string): Promise<boolean>; /** * Get manifest manager instance * @returns ManifestManager Manifest manager instance */ getManifestManager(): ManifestManager; } //# sourceMappingURL=cacheManager.d.ts.map