taskforce-aiagent
Version:
TaskForce is a modular, open-source, production-ready TypeScript agent framework for orchestrating AI agents, LLM-powered autonomous agents, task pipelines, dynamic toolchains, RAG workflows and memory/retrieval systems.
34 lines (33 loc) • 826 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LRUCacheHelper = void 0;
exports.getToolCache = getToolCache;
const lru_cache_1 = require("lru-cache");
class LRUCacheHelper {
constructor(maxEntries = 100, ttlMs = 1000 * 60 * 10) {
this.cache = new lru_cache_1.LRUCache({
max: maxEntries,
ttl: ttlMs,
});
}
get(key) {
return this.cache.get(key);
}
set(key, value) {
this.cache.set(key, value);
}
has(key) {
return this.cache.has(key);
}
clear() {
this.cache.clear();
}
}
exports.LRUCacheHelper = LRUCacheHelper;
let globalToolCache = null;
function getToolCache() {
if (!globalToolCache) {
globalToolCache = new LRUCacheHelper();
}
return globalToolCache;
}