/** * A class representing a simple cache system that stores data in the file system. * @template T - The type of data to be cached. */ export declare class Cache { /** * The temporary directory where cache files are stored. */ protected readonly tmpDir: string; /** * Creates an instance of Cache. * @param name - The name of the cache, used to create a subdirectory in the temporary directory. * @param tmpDir - Optional. The base temporary directory. Defaults to the system's temporary directory. */ constructor(name: string, tmpDir?: string); /** * Clears the cache by removing all files in the cache directory. * @returns A promise that resolves when the cache has been cleared. */ clear(): Promise; /** * Loads a cached value by its key. * @param key - The key of the cached value. * @param reviver - Optional. A function that transforms the results. This function is called for each member of the object. * @returns A promise that resolves to the cached value, or null if the value is not found. */ load(key: string, reviver?: Parameters[1]): Promise; /** * Stores a value in the cache. * @param key - The key under which the value should be stored. * @param value - The value to be cached. * @returns A promise that resolves to the filename of the cached value. */ store(key: string, value: T): Promise; } /** * A class that extends the `Cache` class to handle binary data using `Buffer`. * This class provides methods to load and store binary data in a temporary directory. * @augments {Cache} */ export declare class BinaryCache extends Cache { /** * Checks if a cached file exists for the given key. * @param {string} key - The key to check in the cache. * @returns A promise that resolves to `true` if the file exists, otherwise `false`. */ exists(key: string): Promise; /** * Loads binary data directly from the cache using the provided hashed key. * @param {string} hashedKey - The hashed key to identify the cached data. * @returns {Promise} - A promise that resolves to the binary data or null if not found. */ loadDirectly(hashedKey: string): Promise; /** * Loads binary data from the cache using the provided key. * The key is hashed and used to generate the filename. * @param {string} key - The key to identify the cached data. * @returns {Promise} - A promise that resolves to the binary data or null if not found. */ load(key: string): Promise; /** * Stores binary data in the cache using the provided key. * The key is hashed and used to generate the filename. * @param {string} key - The key to identify the cached data. * @param {Uint8Array} value - The binary data to be stored. * @returns {Promise} - A promise that resolves to the filename of the cached data. */ store(key: string, value: Uint8Array): Promise; }