/** * 挂载在app和agent上的用于用户缓存数据操作的map */ export default class AppCache { private map; private config; constructor(config?: Record); static init(config?: Record): AppCache; /** * 添加一个缓存 * * @param {string} key 字段key,注意不能重复 * @param {*} value * @param {number} seconds 缓存时间,按s为单位 默认20s * @memberof AppCache */ set(key: string, value: any, seconds?: number): boolean; /** * 获取缓存 * * @template T * @param {string} key * @return {*} {(T | null)} * @memberof AppCache */ get(key: string): T | null; remove(key: string): boolean; delete(key: string): boolean; /** * 移除已失效的缓存 */ removeExpired(): boolean; reset(): void; clear(): void; /** 定时清理缓存 */ private startTimeoutClear; }