UNPKG

533 BTypeScriptView Raw
1type Timer = ReturnType<typeof setTimeout>;
2type CachedKey = string | number;
3export interface CachedData<TData = any, TParams = any> {
4 data: TData;
5 params: TParams;
6 time: number;
7}
8interface RecordData extends CachedData {
9 timer: Timer | undefined;
10}
11declare const setCache: (key: CachedKey, cacheTime: number, cachedData: CachedData) => void;
12declare const getCache: (key: CachedKey) => RecordData | undefined;
13declare const clearCache: (key?: string | string[]) => void;
14export { getCache, setCache, clearCache };