@nomyx/assistant
Version:
A powerful assistant library and cli for your AI projects. works with Vertex AI (Claude and Gemini)
30 lines (29 loc) • 872 B
JavaScript
;
// LOCKED: TRUE
// All content in this file is locked and cannot be edited.
Object.defineProperty(exports, "__esModule", { value: true });
exports.RedisCacheManager = void 0;
const redis_1 = require("redis");
class RedisCacheManager {
constructor(redisUrl) {
this.client = (0, redis_1.createClient)({ url: redisUrl });
this.client.connect().catch(console.error);
}
async get(key) {
const value = await this.client.get(key);
return value ? JSON.parse(value) : null;
}
async set(key, value, ttl) {
await this.client.setEx(key, ttl, JSON.stringify(value));
}
async delete(key) {
await this.client.del(key);
}
async clear() {
await this.client.flushDb();
}
async close() {
await this.client.quit();
}
}
exports.RedisCacheManager = RedisCacheManager;