import { AbstractMemoryStorageService } from "../abstractions/storage.service"; export class MemoryStorageService extends AbstractMemoryStorageService { private store = new Map(); get(key: string): Promise { if (this.store.has(key)) { const obj = this.store.get(key); return Promise.resolve(obj as T); } return Promise.resolve(null); } async has(key: string): Promise { return (await this.get(key)) != null; } save(key: string, obj: any): Promise { if (obj == null) { return this.remove(key); } this.store.set(key, obj); return Promise.resolve(); } remove(key: string): Promise { this.store.delete(key); return Promise.resolve(); } getBypassCache(key: string): Promise { return this.get(key); } }