export { CacheStore, BaseCacheStore } from './cache-store.ts' import { CacheStore } from './cache-store.ts' /** * 一个简单的缓存类,用于存储字符串。 * 对数据进行添加对比内容。 */ export class MyCache extends CacheStore { key: string; constructor(opts?: { key?: string }) { const { key, ...rest } = opts || {}; super(rest); this.key = key || 'my-cache'; } async getData(key: string = this.key): Promise { return super.getCheckData(key) as any; } /** * 设置缓存数据,默认过期时间为10天 * @param data * @param opts */ async setData(data: U, opts?: { expireTime?: number, updatedAt?: number }) { super.setCheckData(this.key, data, opts); } async del(): Promise { await super.del(this.key); } }