@push.rocks/smartcache
Version:
cache things in smart ways
26 lines (25 loc) • 899 B
TypeScript
import * as plugins from './smartcache.plugins.js';
export interface ICacheMap {
[key: string]: {
timer: plugins.smarttime.Timer;
cachedDeferred: plugins.smartpromise.Deferred<any>;
cachedObject: any;
};
}
export declare class CacheManager {
private _cacheMap;
cacheExists(identifierArg: string): boolean;
stillValid(identifierArg: string): boolean;
announceCache(identifierArg: string, validForArg: number): void;
/**
* waits for the cache to be ready
*/
waitForCacheReady(identifierArg: string): Promise<boolean>;
setCache(identifierArg: string, cachedObjectArg: any, validForArg?: number): void;
getCache(identifierArg: string): {
timer: plugins.smarttime.Timer;
cachedDeferred: plugins.smartpromise.Deferred<any>;
cachedObject: any;
};
deleteCache(identifierArg: string): Promise<void>;
}