n8n-nodes-feishu-lark
Version:
n8n custom nodes for n8n to interact with Feishu/Lark, including Lark Bot, Lark MCP, and Lark Trigger.
37 lines • 1.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.internalCache = exports.DefaultCache = void 0;
class DefaultCache {
constructor() {
this.values = new Map();
}
getCacheKey(key, namespace) {
if (namespace) {
return `${namespace}/${key.toString()}`;
}
return key;
}
async get(key, options) {
const cacheKey = this.getCacheKey(key, options === null || options === void 0 ? void 0 : options.namespace);
const data = this.values.get(cacheKey);
if (data) {
const { value, expiredTime } = data;
if (!expiredTime || expiredTime - new Date().getTime() > 0) {
return value;
}
this.values.delete(cacheKey);
}
return undefined;
}
async set(key, value, expiredTime, options) {
const cacheKey = this.getCacheKey(key, options === null || options === void 0 ? void 0 : options.namespace);
this.values.set(cacheKey, {
value,
expiredTime,
});
return true;
}
}
exports.DefaultCache = DefaultCache;
exports.internalCache = new DefaultCache();
//# sourceMappingURL=cache.js.map