mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-31 14:59:05 +08:00
* feat: pnpm new * Refactor build and release workflows, update dependencies Switch build scripts and workflows from npm to pnpm, update build and artifact paths, and simplify release workflow by removing version detection and changelog steps. Add new dependencies (silk-wasm, express, ws, node-pty-prebuilt-multiarch), update exports in package.json files, and add vite config for napcat-framework. Also, rename manifest.json for framework package and fix static asset copying in shell build config.
22 lines
464 B
TypeScript
22 lines
464 B
TypeScript
class Store {
|
|
private store = new Map<string, any>();
|
|
|
|
set<T> (key: string, value: T, ttl?: number): void {
|
|
this.store.set(key, value);
|
|
if (ttl) {
|
|
setTimeout(() => this.store.delete(key), ttl * 1000);
|
|
}
|
|
}
|
|
|
|
get<T> (key: string): T | null {
|
|
return this.store.get(key) ?? null;
|
|
}
|
|
|
|
exists (...keys: string[]): number {
|
|
return keys.filter(key => this.store.has(key)).length;
|
|
}
|
|
}
|
|
|
|
const store = new Store();
|
|
|
|
export default store; |