UNPKG

@larksuiteoapi/core

Version:
31 lines 849 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DefaultStore = void 0; class V { constructor(value, expire) { this.value = value; this.expireTime = new Date(new Date().getTime() + expire * 1000); } } class DefaultStore { constructor() { this.get = (key) => { let v = this.data.get(key); if (!v) { return ""; } let now = new Date().getTime(); if (v.expireTime.getTime() < now) { return ""; } return v.value; }; this.put = (key, value, expire) => { let v = new V(value, expire); this.data.set(key, v); }; this.data = new Map(); } } exports.DefaultStore = DefaultStore; //# sourceMappingURL=store.js.map