/** * @file MemCache 数据缓存 */ /** * 数据缓存 */ export declare class MemCache { /** * 当前缓存 * */ private cache; /** * 是否使用直接缓存 */ private readonly direct; /** * 构造函数 * * @desc 如果direct为false,将使用deepClone进行复制,为了保证数据的一致性,请保证T的类型是JSON类型数据 * @param direct 是否直接使用缓存 */ constructor(direct?: boolean); /** * 添加缓存 * * @param key 添加key * @param value 值 */ addCache(key: string, value: T): void; /** * 删除key * * @return 返回被删除的所有值 */ removeCache(): { [key: string]: T; }; removeCache(key: string): T; /** * 获取所有缓存 * * @return 返回缓存的值 */ getCache(): { [key: string]: T; }; /** * 获取cache * * @param key 缓存对应的key * @return 返回缓存的值 */ getCache(key: string): T; /** * 是否包含对应的缓存 * * @param key 缓存名 */ hasKey(key: string): boolean; }