export type MemoryCache = { /** * 读取一条缓存 * * @param key - 缓存的键 * @returns 缓存的值 */ get(key: string): Promise; /** * 写入一条缓存 * * @param key - 缓存的键 * @param value - 缓存的值 * @param ttl - 单位为秒 * @returns 是否写入成功 */ set(key: string, value: Value, ttl?: number): Promise; /** * 删除一条缓存 * @param key - 缓存的键 * @returns 是否删除成功 */ delete(key: string): Promise; /** * 删除所有条目 */ clear(): Promise; }; export type State = { restore: () => Promise; clear: () => Promise; [key: string]: any; };