UNPKG

@themineway/smart-storage-js

Version:

A TS/JS library that provides a smart and easy way to store data

23 lines 601 B
import { AConnector } from "../connector.abstract"; export class InMemoryConnector extends AConnector { constructor(storage = new Map()) { super("inMemory", true); this.storage = storage; } rawGet(key) { if (this.storage.has(key) === false) return null; const value = this.storage.get(key); return value; } rawSet(key, value) { this.storage.set(key, value); } remove(key) { this.storage.delete(key); } clear() { this.storage.clear(); } } //# sourceMappingURL=in-memory-connector.js.map