mirror of
https://github.com/certd/certd.git
synced 2026-05-16 21:27:34 +08:00
18 lines
303 B
TypeScript
18 lines
303 B
TypeScript
|
|
export class Cache {
|
||
|
|
bucket: Record<string, any> = {};
|
||
|
|
|
||
|
|
async get(key: string) {
|
||
|
|
return this.bucket[key];
|
||
|
|
}
|
||
|
|
|
||
|
|
async set(key: string, value: any, ttl: number) {
|
||
|
|
this.bucket[key] = value;
|
||
|
|
}
|
||
|
|
|
||
|
|
async del(key: string) {
|
||
|
|
delete this.bucket[key];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export const cache = new Cache();
|