/**
 * A simple in-memory cache client that stores values in a map with TTL support.
 */
export class MemoryCacheClient {
    cache = new Map();
    get(key) {
        return new Promise((resolve) => {
            const entry = this.cache.get(key);
            if (entry === undefined)
                return resolve(null);
            if (entry.expiresAt && entry.expiresAt < Date.now()) {
                this.cache.delete(key);
                return resolve(null);
            }
            resolve(entry.value);
        });
    }
    set(key, value, ttl) {
        return new Promise((resolve) => {
            const expiresAt = ttl ? Date.now() + ttl * 1000 : null;
            this.cache.set(key, { value, expiresAt });
            resolve(key);
        });
    }
}
//# sourceMappingURL=MemoryCacheClient.js.map