export type UseMemoizeCache<Key, Value> = {
get: (key: Key) => Value | undefined
set: (key: Key, value: Value) => void
has: (key: Key) => boolean
delete: (key: Key) => void
clear(): void
}
export type UseMemoizeOptions<Result, Args extends unknown[]> = {
/**
* 自定义缓存键生成器
*
* @defaultValue JSON.stringify(args)
*/
getKey?: (...args: Args) => string | number
/**
* 自定义缓存,可以是 Map 或其他实现了缓存接口的对象
*
* @defaultValue new Map()
*/
cache?: UseMemoizeCache<CacheKey, Result>
}