UNPKG

@valo/cache

Version:
45 lines (44 loc) 1 kB
export declare class CacheService { private dbName; private dbVersion; private verbose; private readonly storeName; private db; constructor(dbName: string, dbVersion?: number, verbose?: boolean); /** * Initialize the database */ init(): Promise<boolean>; /** * Retrieve data from the cache * @param cacheKey */ get<T>(cacheKey: string): Promise<T>; /** * Add data to the cache * @param cacheKey * @param data * @param expire */ put(cacheKey: string, data: any, expire?: Date): Promise<boolean>; /** * Delete the key from the cache * @param cacheKey */ delete(cacheKey: string): Promise<void>; /** * Flush the whole cache store */ flush(): Promise<void>; /** * Creates a presistable object for the store * @param data * @param expire */ private createPersistable; /** * Logging * @param message */ private log; }