/** * Optional check result cache — non-authoritative, TTL-based. * * Stores previous `check()` outputs to reduce repeated SSH work on stable hosts * in check mode. Apply mode always performs a live check; cache is advisory for * check mode only. */ import type { CacheLookup, CheckResult, CheckResultCache } from "./types.ts"; /** Default TTL for cache entries: 10 minutes. */ export declare const DEFAULT_CACHE_TTL_MS: number; /** Default on-disk cache file path (workspace-local). */ export declare const DEFAULT_CACHE_FILE: string; /** Components used to build a cache key. */ export type CacheKeyParts = { /** SSH hostname or IP. */ hostname: string; /** SSH port. */ port: number; /** SSH user. */ user: string; /** Resource type identifier. */ resourceType: string; /** Resource display name. */ resourceName: string; /** Normalized resource input (JSON-serialized). */ inputJson: string; }; /** * Build a deterministic cache key string from the component parts. * * Key includes tool version so that cache entries are automatically * invalidated when the tool is upgraded. */ export declare function buildCacheKey(parts: CacheKeyParts): string; /** A stored cache entry with metadata. */ export type CacheEntry = { /** The cached check result. */ result: CheckResult; /** Timestamp when the entry was stored (ms since epoch). */ storedAt: number; /** Cache key for this entry. */ key: string; }; /** Configuration for the cache. */ export type CacheOptions = { /** TTL in milliseconds. Entries older than this are considered expired. */ ttlMs: number; }; /** * In-memory check result cache with TTL-based expiration. * * Entries are stored in a Map keyed by the cache key string. Expired entries * are lazily evicted on access. This is the primary cache backend — filesystem * persistence can be layered on top if needed. */ export declare class MemoryCheckResultCache implements CheckResultCache { #private; constructor(opts?: Partial); get(key: string): CacheLookup; set(key: string, result: CheckResult): void; clear(): void; get size(): number; } /** Configuration for file-backed cache. */ export type FileCacheOptions = CacheOptions & { /** Absolute or relative path to the JSON cache file. */ path: string; }; /** * File-backed check result cache with in-memory working set + JSON persistence. * * The cache file is loaded at construction and rewritten on every mutation. * Entries are non-authoritative and TTL-validated exactly like memory cache. */ export declare class FileCheckResultCache implements CheckResultCache { #private; constructor(opts?: Partial); get(key: string): CacheLookup; set(key: string, result: CheckResult): void; clear(): void; get size(): number; } //# sourceMappingURL=cache.d.ts.map