UNPKG

n8n-nodes-wax

Version:

n8n Community Node Package for the WAX Blockchain

29 lines (28 loc) 710 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MemoryCache = void 0; class MemoryCache { constructor() { this.store = {}; } get(key) { const res = this.store[key]; if (typeof res === 'undefined') { return null; } const [value, expires] = res; if (new Date() > expires) { delete this.store[key]; return null; } return value; } put(key, value, timeout) { const expires = new Date(Date.now() + timeout); this.store[key] = [value, expires]; } remove(key) { delete this.store[key]; } } exports.MemoryCache = MemoryCache;