@hhgtech/hhg-components
Version:
Hello Health Group common components
8 lines (7 loc) • 377 B
TypeScript
export type CacheItem<T = any> = {
data: T;
time: number;
};
export declare const getCachedItem: <T>(key: string) => CacheItem<T>;
export declare const setCachedItem: (key: string, value: any) => void;
export declare const getDataWithCache: <T>(key: string, dataGetter?: () => T | Promise<T>, validator?: (data: T) => boolean, cacheTime?: number) => Promise<T>;