UNPKG

487 BTypeScriptView Raw
1/**
2 * @name useGarbageCollection
3 * @author Fajar Rizky Hidayat <fajarrizkyhidayat@gmail.com>
4 */
5
6interface GarbageProps {
7 key: string;
8 ttl?: number;
9 periodTime?: number;
10 periodically?: boolean;
11}
12
13type UseGarbageCollection = {
14 cache: any;
15 has: (key: string) => boolean;
16 add: (value: any,key?: string) => void;
17 clear:(key?: string) => void;
18 get: (key: string) => any;
19};
20
21export default function useGarbageCollection(
22 props: GarbageProps
23): UseGarbageCollection;