@typecad/jlcpcb-parts
Version:
Intelligent fuzzy search for JLCPCB electrical components with CLI interface
47 lines • 1.81 kB
TypeScript
/**
* Manages timestamp tracking for cache expiration.
* Supports both shared cache directory and custom cache directory modes.
*/
export declare class TimestampManager {
private readonly cacheExpirationHours;
private readonly useSharedCache;
private readonly customCacheDir;
private timestampFilePath;
/**
* Creates a new TimestampManager
* @param cacheDir Custom cache directory (used when useSharedCache is false)
* @param cacheExpirationHours Number of hours before cache expires
* @param useSharedCache Whether to use shared cache directory (default: true)
*/
constructor(cacheDir?: string, cacheExpirationHours?: number, useSharedCache?: boolean);
/**
* Gets the timestamp file path, resolving it asynchronously if needed
* @returns Promise that resolves to the timestamp file path
*/
private getTimestampFilePath;
/**
* Reads the timestamp from the timestamp file
* @returns The timestamp as a Date object, or null if file doesn't exist or is invalid
*/
readTimestamp(): Promise<Date | null>;
/**
* Writes the current timestamp to the timestamp file
* @param timestamp Optional timestamp to write, defaults to current time
*/
writeTimestamp(timestamp?: Date): Promise<void>;
/**
* Checks if the cache is stale based on the timestamp file
* @returns true if cache is stale (older than expiration time or doesn't exist)
*/
isCacheStale(): Promise<boolean>;
/**
* Gets the age of the cache in hours
* @returns Age in hours, or null if no timestamp exists
*/
getCacheAgeHours(): Promise<number | null>;
/**
* Deletes the timestamp file
*/
deleteTimestamp(): Promise<void>;
}
//# sourceMappingURL=TimestampManager.d.ts.map