UNPKG

commitmnt

Version:

Copy your gitlab and bitbucket commits to a new, publishable github repo

42 lines (41 loc) 1.11 kB
/** * Very simple cache class that uses the filesystem */ export declare class Cache { dir: string; /** * @param baseDir the directory to create the .cache directory in * @constructor */ constructor(baseDir?: string); /** * Gets a value from the cache * * @param key the cache key to lookup * @template R the type of the return value * @returns the value for `key` as json or null if key doesn't exist */ get<R>(key: string): Promise<R | void>; /** * Sets a value to the cache * * @param key the cache key to set the value at * @param value the value to set * @template R the type of the value */ set<R>(key: string, val: R): Promise<void>; /** * Gets the path to a file for a given key * * @param key the cache key to get the path for * @returns the path */ getPath(key: string): string; /** * Hashes a given key * * @param key the cache key to hash * @returns the hashed key */ private hash; }