UNPKG

gather-ts

Version:

A powerful code analysis and packaging tool designed for creating AI-friendly code representations for javascript and typescript projects.

29 lines (28 loc) 1.1 kB
import { ITokenCache, ICacheStats, ITokenCacheDeps, ITokenCacheOptions } from "./interfaces/ITokenCache"; import { BaseService } from "@/types/services"; export type CacheOperation = "read" | "write" | "delete" | "clear" | "expire"; export declare class TokenCache extends BaseService implements ITokenCache { private readonly deps; private readonly cachePath; private readonly projectRoot; private cache; private readonly maxCacheAge; private readonly debug; private stats; constructor(projectRoot: string, deps: ITokenCacheDeps, options?: ITokenCacheOptions); initialize(): Promise<void>; private initializeCachePath; cleanup(): void; private logDebug; private handleError; private validateCacheEntry; private getRelativeCachePath; private loadCache; private saveCache; private computeHash; getCachedTokenCount(filePath: string, content: string): number | null; cacheTokenCount(filePath: string, content: string, tokens: number): void; clear(): void; private updateStats; getCacheStats(): ICacheStats; }